summaryrefslogtreecommitdiff
path: root/spec/services/git
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/services/git
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/services/git')
-rw-r--r--spec/services/git/branch_hooks_service_spec.rb8
-rw-r--r--spec/services/git/wiki_push_service/change_spec.rb6
-rw-r--r--spec/services/git/wiki_push_service_spec.rb16
3 files changed, 15 insertions, 15 deletions
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb
index ae0506ad442..908b9772c40 100644
--- a/spec/services/git/branch_hooks_service_spec.rb
+++ b/spec/services/git/branch_hooks_service_spec.rb
@@ -91,7 +91,7 @@ describe Git::BranchHooksService do
end
describe 'Push Event' do
- let(:event) { Event.find_by_action(Event::PUSHED) }
+ let(:event) { Event.pushed_action.first }
before do
service.execute
@@ -101,7 +101,7 @@ describe Git::BranchHooksService do
it 'generates a push event with one commit' do
expect(event).to be_an_instance_of(PushEvent)
expect(event.project).to eq(project)
- expect(event.action).to eq(Event::PUSHED)
+ 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 eq(oldrev)
expect(event.push_event_payload.commit_to).to eq(newrev)
@@ -117,7 +117,7 @@ describe Git::BranchHooksService do
it 'generates a push event with more than one commit' do
expect(event).to be_an_instance_of(PushEvent)
expect(event.project).to eq(project)
- expect(event.action).to eq(Event::PUSHED)
+ 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)
@@ -133,7 +133,7 @@ describe Git::BranchHooksService do
it 'generates a push event with no commits' do
expect(event).to be_an_instance_of(PushEvent)
expect(event.project).to eq(project)
- expect(event.action).to eq(Event::PUSHED)
+ 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 eq(oldrev)
expect(event.push_event_payload.commit_to).to be_nil
diff --git a/spec/services/git/wiki_push_service/change_spec.rb b/spec/services/git/wiki_push_service/change_spec.rb
index 547874270ab..4da3f0fc738 100644
--- a/spec/services/git/wiki_push_service/change_spec.rb
+++ b/spec/services/git/wiki_push_service/change_spec.rb
@@ -89,20 +89,20 @@ describe Git::WikiPushService::Change do
context 'the page is deleted' do
let(:operation) { :deleted }
- it { is_expected.to have_attributes(event_action: Event::DESTROYED) }
+ it { is_expected.to have_attributes(event_action: :destroyed) }
end
context 'the page is added' do
let(:operation) { :added }
- it { is_expected.to have_attributes(event_action: Event::CREATED) }
+ it { is_expected.to have_attributes(event_action: :created) }
end
%i[renamed modified].each do |op|
context "the page is #{op}" do
let(:operation) { op }
- it { is_expected.to have_attributes(event_action: Event::UPDATED) }
+ it { is_expected.to have_attributes(event_action: :updated) }
end
end
end
diff --git a/spec/services/git/wiki_push_service_spec.rb b/spec/services/git/wiki_push_service_spec.rb
index cdb1dc5a435..b2234c81c24 100644
--- a/spec/services/git/wiki_push_service_spec.rb
+++ b/spec/services/git/wiki_push_service_spec.rb
@@ -54,7 +54,7 @@ describe Git::WikiPushService, services: true do
it 'handles all known actions' do
run_service
- expect(Event.last(count).pluck(:action)).to match_array(Event::WIKI_ACTIONS)
+ expect(Event.last(count).pluck(:action)).to match_array(Event::WIKI_ACTIONS.map(&:to_s))
end
end
@@ -77,7 +77,7 @@ describe Git::WikiPushService, services: true do
it 'creates appropriate events' do
run_service
- expect(Event.last(2)).to all(have_attributes(wiki_page?: true, action: Event::CREATED))
+ expect(Event.last(2)).to all(have_attributes(wiki_page?: true, action: 'created'))
end
end
@@ -100,7 +100,7 @@ describe Git::WikiPushService, services: true do
it 'creates a wiki page creation event' do
expect { run_service }.to change(Event, :count).by(1)
- expect(Event.last).to have_attributes(wiki_page?: true, action: Event::CREATED)
+ expect(Event.last).to have_attributes(wiki_page?: true, action: 'created')
end
it 'creates one metadata record' do
@@ -129,7 +129,7 @@ describe Git::WikiPushService, services: true do
expect(Event.last).to have_attributes(
wiki_page?: true,
- action: Event::CREATED
+ action: 'created'
)
end
end
@@ -158,7 +158,7 @@ describe Git::WikiPushService, services: true do
expect(Event.last).to have_attributes(
wiki_page?: true,
- action: Event::UPDATED
+ action: 'updated'
)
end
end
@@ -182,7 +182,7 @@ describe Git::WikiPushService, services: true do
expect(Event.last).to have_attributes(
wiki_page?: true,
- action: Event::UPDATED
+ action: 'updated'
)
end
end
@@ -206,7 +206,7 @@ describe Git::WikiPushService, services: true do
expect(Event.last).to have_attributes(
wiki_page?: true,
- action: Event::DESTROYED
+ action: 'destroyed'
)
end
end
@@ -218,7 +218,7 @@ describe Git::WikiPushService, services: true do
message = 'something went very very wrong'
allow_next_instance_of(WikiPages::EventCreateService, current_user) do |service|
allow(service).to receive(:execute)
- .with(String, WikiPage, Integer)
+ .with(String, WikiPage, Symbol)
.and_return(ServiceResponse.error(message: message))
end