diff options
Diffstat (limited to 'spec/support/shared_contexts/lib/gitlab/git_access_shared_examples.rb')
-rw-r--r-- | spec/support/shared_contexts/lib/gitlab/git_access_shared_examples.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/lib/gitlab/git_access_shared_examples.rb b/spec/support/shared_contexts/lib/gitlab/git_access_shared_examples.rb new file mode 100644 index 00000000000..837c1c37aa3 --- /dev/null +++ b/spec/support/shared_contexts/lib/gitlab/git_access_shared_examples.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'forbidden git access' do + let(:message) { /You can't/ } + + it 'prevents access' do + expect { subject }.to raise_error(Gitlab::GitAccess::ForbiddenError, message) + end +end + +RSpec.shared_examples 'not-found git access' do + let(:message) { /not found/ } + + it 'prevents access' do + expect { subject }.to raise_error(Gitlab::GitAccess::NotFoundError, message) + end +end |