diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 15:08:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 15:08:10 +0300 |
commit | b86f474bf51e20d2db4cf0895d0a8e0894e31c08 (patch) | |
tree | 061d2a4c749924f5a35fe6199dd1d8982c4b0b27 /spec/lib/gitlab/auth/request_authenticator_spec.rb | |
parent | 6b8040dc25fdc5fe614c3796a147517dd50bc7d8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/auth/request_authenticator_spec.rb')
-rw-r--r-- | spec/lib/gitlab/auth/request_authenticator_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/auth/request_authenticator_spec.rb b/spec/lib/gitlab/auth/request_authenticator_spec.rb index f7fff389d88..4dbcd0df302 100644 --- a/spec/lib/gitlab/auth/request_authenticator_spec.rb +++ b/spec/lib/gitlab/auth/request_authenticator_spec.rb @@ -66,4 +66,28 @@ describe Gitlab::Auth::RequestAuthenticator do expect(subject.find_sessionless_user([:api])).to be_blank end end + + describe '#runner' do + let!(:runner) { build(:ci_runner) } + + it 'returns the runner using #find_runner_from_token' do + expect_any_instance_of(described_class) + .to receive(:find_runner_from_token) + .and_return(runner) + + expect(subject.runner).to eq runner + end + + it 'returns nil if no runner is found' do + expect(subject.runner).to be_blank + end + + it 'rescue Gitlab::Auth::AuthenticationError exceptions' do + expect_any_instance_of(described_class) + .to receive(:find_runner_from_token) + .and_raise(Gitlab::Auth::UnauthorizedError) + + expect(subject.runner).to be_blank + end + end end |