debian-mirror-gitlab/spec/models/clusters/agent_token_spec.rb

24 lines
571 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Clusters::AgentToken do
it { is_expected.to belong_to(:agent).class_name('Clusters::Agent') }
describe '#token' do
it 'is generated on save' do
agent_token = build(:cluster_agent_token, token_encrypted: nil)
expect(agent_token.token).to be_nil
agent_token.save!
expect(agent_token.token).to be_present
end
2021-01-29 00:20:46 +05:30
it 'is at least 50 characters' do
agent_token = create(:cluster_agent_token)
expect(agent_token.token.length).to be >= 50
end
2020-10-24 23:57:45 +05:30
end
end