summaryrefslogtreecommitdiff
path: root/spec/workers/post_receive_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/workers/post_receive_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r--spec/workers/post_receive_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index 3d24b5f753a..aab7a36189a 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -299,6 +299,31 @@ describe PostReceive do
end
end
+ context "master" do
+ let(:default_branch) { 'master' }
+ let(:oldrev) { '012345' }
+ let(:newrev) { '6789ab' }
+ let(:changes) do
+ <<~EOF
+ #{oldrev} #{newrev} refs/heads/#{default_branch}
+ 123456 789012 refs/heads/tést2
+ EOF
+ end
+
+ let(:raw_repo) { double('RawRepo') }
+
+ it 'processes the changes on the master branch' do
+ expect_next_instance_of(Git::WikiPushService) do |service|
+ expect(service).to receive(:process_changes).and_call_original
+ end
+ expect(project.wiki).to receive(:default_branch).twice.and_return(default_branch)
+ expect(project.wiki.repository).to receive(:raw).and_return(raw_repo)
+ expect(raw_repo).to receive(:raw_changes_between).once.with(oldrev, newrev).and_return([])
+
+ perform
+ end
+ end
+
context "branches" do
let(:changes) do
<<~EOF
@@ -307,6 +332,12 @@ describe PostReceive do
EOF
end
+ before do
+ allow_next_instance_of(Git::WikiPushService) do |service|
+ allow(service).to receive(:process_changes)
+ end
+ end
+
it 'expires the branches cache' do
expect(project.wiki.repository).to receive(:expire_branches_cache).once
@@ -440,4 +471,17 @@ describe PostReceive do
it_behaves_like 'snippet changes actions'
end
end
+
+ describe 'processing design changes' do
+ let(:gl_repository) { "design-#{project.id}" }
+
+ it 'does not do anything' do
+ worker = described_class.new
+
+ expect(worker).not_to receive(:process_wiki_changes)
+ expect(worker).not_to receive(:process_project_changes)
+
+ described_class.new.perform(gl_repository, key_id, base64_changes)
+ end
+ end
end