summaryrefslogtreecommitdiff
path: root/spec/workers/post_receive_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 12:06:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 12:06:00 +0000
commit927cfbfe63dd3dc64df9d341d7c4328a2fe3597f (patch)
treecaa1dc128491ed9dbfdcd40737db429f4b066707 /spec/workers/post_receive_spec.rb
parent2b67531b0fd7c94cb1d8618166c4193f40ea5a1f (diff)
downloadgitlab-ce-927cfbfe63dd3dc64df9d341d7c4328a2fe3597f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r--spec/workers/post_receive_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index fb89eae9fa9..d034e962cee 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -61,6 +61,16 @@ describe PostReceive do
end
end
+ shared_examples 'not updating remote mirrors' do
+ it 'does not schedule an update' do
+ expect(project).not_to receive(:has_remote_mirror?)
+ expect(project).not_to receive(:mark_stuck_remote_mirrors_as_failed!)
+ expect(project).not_to receive(:update_remote_mirrors)
+
+ perform
+ end
+ end
+
context 'empty changes' do
it "does not call any PushService but runs after project hooks" do
expect(Git::BranchPushService).not_to receive(:new)
@@ -69,6 +79,8 @@ describe PostReceive do
perform(changes: "")
end
+
+ it_behaves_like 'not updating remote mirrors'
end
context 'unidentified user' do
@@ -88,6 +100,16 @@ describe PostReceive do
allow(Gitlab::GlRepository).to receive(:parse).and_return([project, Gitlab::GlRepository::PROJECT])
end
+ shared_examples 'updating remote mirrors' do
+ it 'schedules an update if the project had mirrors' do
+ expect(project).to receive(:has_remote_mirror?).and_return(true)
+ expect(project).to receive(:mark_stuck_remote_mirrors_as_failed!)
+ expect(project).to receive(:update_remote_mirrors)
+
+ perform
+ end
+ end
+
context "branches" do
let(:changes) do
<<~EOF
@@ -126,6 +148,8 @@ describe PostReceive do
perform
end
+ it_behaves_like 'updating remote mirrors'
+
context 'with a default branch' do
let(:changes) do
<<~EOF
@@ -191,6 +215,8 @@ describe PostReceive do
perform
end
+
+ it_behaves_like 'updating remote mirrors'
end
context "merge-requests" do
@@ -202,6 +228,8 @@ describe PostReceive do
perform
end
+
+ it_behaves_like 'not updating remote mirrors'
end
context "gitlab-ci.yml" do