diff options
Diffstat (limited to 'spec/services/git/branch_push_service_spec.rb')
-rw-r--r-- | spec/services/git/branch_push_service_spec.rb | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index 6ecc1a62ff3..6ccf2d03e4a 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::BranchPushService, services: true do +RSpec.describe Git::BranchPushService, services: true do include RepoHelpers let_it_be(:user) { create(:user) } @@ -635,6 +635,37 @@ describe Git::BranchPushService, services: true do end end + describe 'artifacts' do + context 'create branch' do + let(:oldrev) { blankrev } + + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + + context 'update branch' do + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + + context 'delete branch' do + let(:newrev) { blankrev } + + it 'unlocks artifacts' do + expect(::Ci::RefDeleteUnlockArtifactsWorker) + .to receive(:perform_async).with(project.id, user.id, "refs/heads/#{branch}") + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + end + describe 'Hooks' do context 'run on a branch' do it 'delegates to Git::BranchHooksService' do |