summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/checks/change_access_spec.rb
diff options
context:
space:
mode:
authorConstance Okoghenun <constanceokoghenun@gmail.com>2018-11-05 10:33:05 +0100
committerConstance Okoghenun <constanceokoghenun@gmail.com>2018-11-05 10:33:05 +0100
commit3bac1a322c82dd9b6e9b23edd66fa45afaa9859f (patch)
treed3e7d47a3e0c8047cb2972aefbc12fe1e3080ef8 /spec/lib/gitlab/checks/change_access_spec.rb
parentfe7b6f57120946a5d5fe4a4d54a245dc76b06dc8 (diff)
parent9e2eb85e365e2a33e52e3f1f48cc23ad4201a52b (diff)
downloadgitlab-ce-issue_51323.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into issue_51323issue_51323
Diffstat (limited to 'spec/lib/gitlab/checks/change_access_spec.rb')
-rw-r--r--spec/lib/gitlab/checks/change_access_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/lib/gitlab/checks/change_access_spec.rb b/spec/lib/gitlab/checks/change_access_spec.rb
index 4df426c54ae..81804ba5c76 100644
--- a/spec/lib/gitlab/checks/change_access_spec.rb
+++ b/spec/lib/gitlab/checks/change_access_spec.rb
@@ -10,13 +10,16 @@ describe Gitlab::Checks::ChangeAccess do
let(:ref) { 'refs/heads/master' }
let(:changes) { { oldrev: oldrev, newrev: newrev, ref: ref } }
let(:protocol) { 'ssh' }
+ let(:timeout) { Gitlab::GitAccess::INTERNAL_TIMEOUT }
+ let(:logger) { Gitlab::Checks::TimedLogger.new(timeout: timeout) }
subject(:change_access) do
described_class.new(
changes,
project: project,
user_access: user_access,
- protocol: protocol
+ protocol: protocol,
+ logger: logger
)
end
@@ -30,6 +33,19 @@ describe Gitlab::Checks::ChangeAccess do
end
end
+ context 'when time limit was reached' do
+ it 'raises a TimeoutError' do
+ logger = Gitlab::Checks::TimedLogger.new(start_time: timeout.ago, timeout: timeout)
+ access = described_class.new(changes,
+ project: project,
+ user_access: user_access,
+ protocol: protocol,
+ logger: logger)
+
+ expect { access.exec }.to raise_error(Gitlab::Checks::TimedLogger::TimeoutError)
+ end
+ end
+
context 'when the user is not allowed to push to the repo' do
it 'raises an error' do
expect(user_access).to receive(:can_do_action?).with(:push_code).and_return(false)