diff options
author | Robert Speicher <robert@gitlab.com> | 2017-09-29 01:43:37 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-09-29 01:43:37 +0300 |
commit | 07c3112ef540a78c4a84281368eb975ba27a1f4c (patch) | |
tree | c1059a3b6cf1c70c5be3e725cfffa19ced02e08e /spec | |
parent | 3d899a7d2ecc6a815a4c6d0885ff3d24dba74f3c (diff) | |
parent | 3944e16b4bd716fd1f317c89c2c0910de76a2c33 (diff) |
Merge branch 'feature/migrate-repository-rm-tag-to-gitaly' into 'master'
Migrate Git::Repository#rm_tag to Gitaly
Closes gitaly#562
See merge request gitlab-org/gitlab-ce!14388
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/tags/master_deletes_tag_spec.rb | 27 | ||||
-rw-r--r-- | spec/lib/gitlab/workhorse_spec.rb | 3 | ||||
-rw-r--r-- | spec/models/repository_spec.rb | 18 |
3 files changed, 37 insertions, 11 deletions
diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index d6a6b8fc7d5..80750c904b5 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -35,15 +35,30 @@ feature 'Master deletes tag' do end context 'when pre-receive hook fails', js: true do - before do - allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) - .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + context 'when Gitaly operation_user_delete_tag feature is enabled' do + before do + allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag) + .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + end + + scenario 'shows the error message' do + delete_first_tag + + expect(page).to have_content('Do not delete tags') + end end - scenario 'shows the error message' do - delete_first_tag + context 'when Gitaly operation_user_delete_tag feature is disabled', skip_gitaly_mock: true do + before do + allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) + .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + end + + scenario 'shows the error message' do + delete_first_tag - expect(page).to have_content('Do not delete tags') + expect(page).to have_content('Do not delete tags') + end end end diff --git a/spec/lib/gitlab/workhorse_spec.rb b/spec/lib/gitlab/workhorse_spec.rb index 699184ad9fe..a333ae33972 100644 --- a/spec/lib/gitlab/workhorse_spec.rb +++ b/spec/lib/gitlab/workhorse_spec.rb @@ -218,7 +218,8 @@ describe Gitlab::Workhorse do storage_name: 'default', relative_path: project.full_path + '.git', git_object_directory: '', - git_alternate_object_directories: [] + git_alternate_object_directories: [], + gl_repository: '' } } expect(subject).to include(repo_param) diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 07d9b66060e..e63977adec8 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1682,12 +1682,22 @@ describe Repository do end describe '#rm_tag' do - it 'removes a tag' do - expect(repository).to receive(:before_remove_tag) + shared_examples 'removing tag' do + it 'removes a tag' do + expect(repository).to receive(:before_remove_tag) - repository.rm_tag(create(:user), 'v1.1.0') + repository.rm_tag(build_stubbed(:user), 'v1.1.0') - expect(repository.find_tag('v1.1.0')).to be_nil + expect(repository.find_tag('v1.1.0')).to be_nil + end + end + + context 'when Gitaly operation_user_delete_tag feature is enabled' do + it_behaves_like 'removing tag' + end + + context 'when Gitaly operation_user_delete_tag feature is disabled', skip_gitaly_mock: true do + it_behaves_like 'removing tag' end end |