diff options
Diffstat (limited to 'spec/lib/gitlab/checks/tag_check_spec.rb')
-rw-r--r-- | spec/lib/gitlab/checks/tag_check_spec.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/spec/lib/gitlab/checks/tag_check_spec.rb b/spec/lib/gitlab/checks/tag_check_spec.rb index e2e7d9c9648..6cd3a2d1c07 100644 --- a/spec/lib/gitlab/checks/tag_check_spec.rb +++ b/spec/lib/gitlab/checks/tag_check_spec.rb @@ -26,8 +26,18 @@ RSpec.describe Gitlab::Checks::TagCheck do let(:oldrev) { 'be93687618e4b132087f430a4d8fc3a609c9b77c' } let(:newrev) { '0000000000000000000000000000000000000000' } - it 'is prevented' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /cannot be deleted/) + context 'via web interface' do + let(:protocol) { 'web' } + + it 'is allowed' do + expect { subject.validate! }.not_to raise_error + end + end + + context 'via SSH' do + it 'is prevented' do + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /only delete.*web interface/) + end end end @@ -41,6 +51,21 @@ RSpec.describe Gitlab::Checks::TagCheck do end end + context 'as developer' do + before do + project.add_developer(user) + end + + context 'deletion' do + let(:oldrev) { 'be93687618e4b132087f430a4d8fc3a609c9b77c' } + let(:newrev) { '0000000000000000000000000000000000000000' } + + it 'is prevented' do + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, /not allowed to delete/) + end + end + end + context 'creation' do let(:oldrev) { '0000000000000000000000000000000000000000' } let(:newrev) { '54fcc214b94e78d7a41a9a8fe6d87a5e59500e51' } |