diff options
Diffstat (limited to 'spec/lib/gitlab/auth/atlassian/auth_hash_spec.rb')
-rw-r--r-- | spec/lib/gitlab/auth/atlassian/auth_hash_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/gitlab/auth/atlassian/auth_hash_spec.rb b/spec/lib/gitlab/auth/atlassian/auth_hash_spec.rb new file mode 100644 index 00000000000..c57b15361c4 --- /dev/null +++ b/spec/lib/gitlab/auth/atlassian/auth_hash_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Auth::Atlassian::AuthHash do + let(:auth_hash) do + described_class.new( + OmniAuth::AuthHash.new(uid: 'john', credentials: credentials) + ) + end + + let(:credentials) do + { + token: 'super_secret_token', + refresh_token: 'super_secret_refresh_token', + expires_at: 2.weeks.from_now.to_i, + expires: true + } + end + + describe '#uid' do + it 'returns the correct uid' do + expect(auth_hash.uid).to eq('john') + end + end + + describe '#token' do + it 'returns the correct token' do + expect(auth_hash.token).to eq(credentials[:token]) + end + end + + describe '#refresh_token' do + it 'returns the correct refresh token' do + expect(auth_hash.refresh_token).to eq(credentials[:refresh_token]) + end + end + + describe '#token' do + it 'returns the correct expires boolean' do + expect(auth_hash.expires?).to eq(credentials[:expires]) + end + end + + describe '#token' do + it 'returns the correct expiration' do + expect(auth_hash.expires_at).to eq(credentials[:expires_at]) + end + end +end |