diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-18 12:10:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-18 12:10:26 +0300 |
commit | 3b4c0d27d5ad32fecdcc95e86bf919fc13830c5b (patch) | |
tree | 98001b846bd52e10a3aa0fd9adff82b19ae89847 /spec/services | |
parent | 514ace363222f19595375f59b123b5e27c2b9b8a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/git/branch_hooks_service_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb index 6e9404166f3..a93f594b360 100644 --- a/spec/services/git/branch_hooks_service_spec.rb +++ b/spec/services/git/branch_hooks_service_spec.rb @@ -92,7 +92,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state do end describe 'Push Event' do - let(:event) { Event.pushed_action.first } + let(:event) { Event.pushed_action.take } subject(:execute_service) { service.execute } @@ -171,7 +171,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state do end end - context "with a new branch" do + context "with a new default branch" do let(:oldrev) { Gitlab::Git::BLANK_SHA } it 'generates a push event with more than one commit' do @@ -183,12 +183,32 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state do expect(event.push_event_payload).to be_an_instance_of(PushEventPayload) expect(event.push_event_payload.commit_from).to be_nil expect(event.push_event_payload.commit_to).to eq(newrev) - expect(event.push_event_payload.commit_title).to eq('Initial commit') + expect(event.push_event_payload.commit_title).to eq('Change some files') expect(event.push_event_payload.ref).to eq('master') expect(event.push_event_payload.commit_count).to be > 1 end end + context "with a new non-default branch" do + let(:oldrev) { Gitlab::Git::BLANK_SHA } + let(:branch) { 'fix' } + let(:commit_id) { project.commit(branch).id } + + it 'generates a push event with more than one commit' do + execute_service + + expect(event).to be_an_instance_of(PushEvent) + expect(event.project).to eq(project) + expect(event).to be_pushed_action + expect(event.push_event_payload).to be_an_instance_of(PushEventPayload) + expect(event.push_event_payload.commit_from).to be_nil + expect(event.push_event_payload.commit_to).to eq(newrev) + expect(event.push_event_payload.commit_title).to eq('Test file for directories with a leading dot') + expect(event.push_event_payload.ref).to eq('fix') + expect(event.push_event_payload.commit_count).to be > 1 + end + end + context 'removing a branch' do let(:newrev) { Gitlab::Git::BLANK_SHA } |