Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r--spec/workers/post_receive_spec.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index 72e423db611..2a2d0f5a857 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -421,17 +421,35 @@ describe PostReceive do
perform
end
end
+
+ it 'updates the snippet db information' do
+ blob = snippet.blobs.first
+
+ expect(snippet).to receive(:update).with(file_name: blob.path, content: blob.data)
+
+ perform
+ end
+
+ context 'when snippet does not have any blob' do
+ it 'does not update snippet db information' do
+ allow(snippet).to receive(:blobs).and_return([])
+
+ expect(snippet).not_to receive(:update)
+
+ perform
+ end
+ end
end
end
context 'with PersonalSnippet' do
- let!(:snippet) { create(:personal_snippet, author: project.owner) }
+ let!(:snippet) { create(:personal_snippet, :repository, author: project.owner) }
it_behaves_like 'snippet changes actions'
end
context 'with ProjectSnippet' do
- let!(:snippet) { create(:project_snippet, project: project, author: project.owner) }
+ let!(:snippet) { create(:project_snippet, :repository, project: project, author: project.owner) }
it_behaves_like 'snippet changes actions'
end