diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 18:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 18:08:09 +0300 |
commit | d3fc3be040a4fed2328e23ef28696dd8bd8238b4 (patch) | |
tree | f1874ea5e6e3c50c6a3c2ca2900af4ae73a53119 /spec/models/snippet_spec.rb | |
parent | c6c7437861bff9572747674095c4dfbdfbea4988 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/snippet_spec.rb')
-rw-r--r-- | spec/models/snippet_spec.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index cb7b9961880..87ace7b51f4 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -601,10 +601,23 @@ describe Snippet do expect(snippet.create_repository).to be_nil end - it 'does not track snippet repository' do - expect do - snippet.create_repository - end.not_to change(SnippetRepository, :count) + context 'when snippet_repository exists' do + it 'does not create a new snippet repository' do + expect do + snippet.create_repository + end.not_to change(SnippetRepository, :count) + end + end + + context 'when snippet_repository does not exist' do + it 'creates a snippet_repository' do + snippet.snippet_repository.destroy + snippet.reload + + expect do + snippet.create_repository + end.to change(SnippetRepository, :count).by(1) + end end end end |