Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/auth/request_authenticator_spec.rb')
-rw-r--r--spec/lib/gitlab/auth/request_authenticator_spec.rb24
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