Fix bug snippet creation

This commit fixes a bug when a snippet is created and
the feature flag :version_snippets is disabled.
parent c5de0a40
......@@ -24,8 +24,8 @@ module Snippets
spam_check(snippet, current_user)
snippet_saved = snippet.with_transaction_returning_status do
if snippet.save && snippet.store_mentions!
create_repository_for(snippet, current_user)
(snippet.save && snippet.store_mentions!).tap do |saved|
create_repository_for(snippet, current_user) if saved
end
end
......
......@@ -164,7 +164,9 @@ describe Snippets::CreateService do
it 'does not create snippet repository' do
stub_feature_flags(version_snippets: false)
expect do
subject
end.to change(Snippet, :count).by(1)
expect(snippet.repository_exists?).to be_falsey
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment