agent_token_spec.rb 424 Bytes
Newer Older
Thong Kuah's avatar
Thong Kuah committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 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
  end
end