summaryrefslogtreecommitdiff
path: root/spec/services/snippets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 12:09:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 12:09:20 +0000
commitb84eeb256c4a780d902faee1f99ca9a711b3214a (patch)
tree32918aadbea9210eace50efbce9afbfb8cd3ba84 /spec/services/snippets
parent53ae6b7e3f83591ad251a3f771f5bf3b8cf087ba (diff)
downloadgitlab-ce-b84eeb256c4a780d902faee1f99ca9a711b3214a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/snippets')
-rw-r--r--spec/services/snippets/create_service_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb
index 7aa8f0ebf8f..1cf1cff51ed 100644
--- a/spec/services/snippets/create_service_spec.rb
+++ b/spec/services/snippets/create_service_spec.rb
@@ -143,6 +143,34 @@ describe Snippets::CreateService do
end
end
+ shared_examples 'creates repository' do
+ it do
+ subject
+
+ expect(snippet.repository_exists?).to be_truthy
+ end
+
+ context 'when snippet creation fails' do
+ let(:extra_opts) { { content: nil } }
+
+ it 'does not create repository' do
+ subject
+
+ expect(snippet.repository_exists?).to be_falsey
+ end
+ end
+
+ context 'when feature flag :version_snippets is disabled' do
+ it 'does not create snippet repository' do
+ stub_feature_flags(version_snippets: false)
+
+ subject
+
+ expect(snippet.repository_exists?).to be_falsey
+ end
+ end
+ end
+
context 'when Project Snippet' do
let_it_be(:project) { create(:project) }
@@ -155,6 +183,7 @@ describe Snippets::CreateService do
it_behaves_like 'spam check is performed'
it_behaves_like 'snippet create data is tracked'
it_behaves_like 'an error service response when save fails'
+ it_behaves_like 'creates repository'
end
context 'when PersonalSnippet' do
@@ -165,6 +194,7 @@ describe Snippets::CreateService do
it_behaves_like 'spam check is performed'
it_behaves_like 'snippet create data is tracked'
it_behaves_like 'an error service response when save fails'
+ it_behaves_like 'creates repository'
end
end
end