diff options
Diffstat (limited to 'spec/lib/gitlab/api_authentication/token_locator_spec.rb')
-rw-r--r-- | spec/lib/gitlab/api_authentication/token_locator_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/api_authentication/token_locator_spec.rb b/spec/lib/gitlab/api_authentication/token_locator_spec.rb index 68ce48a70ea..e933fd8352e 100644 --- a/spec/lib/gitlab/api_authentication/token_locator_spec.rb +++ b/spec/lib/gitlab/api_authentication/token_locator_spec.rb @@ -51,5 +51,26 @@ RSpec.describe Gitlab::APIAuthentication::TokenLocator do end end end + + context 'with :http_token' do + let(:type) { :http_token } + + context 'without credentials' do + let(:request) { double(headers: {}) } + + it 'returns nil' do + expect(subject).to be(nil) + end + end + + context 'with credentials' do + let(:password) { 'bar' } + let(:request) { double(headers: { "Authorization" => password }) } + + it 'returns the credentials' do + expect(subject.password).to eq(password) + end + end + end end end |