diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 15:08:52 +0000 |
commit | 0ab47b994caa80c5587f33dc818626b66cfdafe2 (patch) | |
tree | 5ef3976d2f84e3368903a67ba2dbd87a74b9a43c /spec/models/snippet_repository_spec.rb | |
parent | 1308dc5eb484ab0f8064989fc551ebdb4b1a7976 (diff) | |
download | gitlab-ce-0ab47b994caa80c5587f33dc818626b66cfdafe2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/snippet_repository_spec.rb')
-rw-r--r-- | spec/models/snippet_repository_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/snippet_repository_spec.rb b/spec/models/snippet_repository_spec.rb new file mode 100644 index 00000000000..9befbb02b17 --- /dev/null +++ b/spec/models/snippet_repository_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe SnippetRepository do + describe 'associations' do + it { is_expected.to belong_to(:shard) } + it { is_expected.to belong_to(:snippet) } + end + + describe '.find_snippet' do + it 'finds snippet by disk path' do + snippet = create(:snippet) + snippet.track_snippet_repository + + expect(described_class.find_snippet(snippet.disk_path)).to eq(snippet) + end + + it 'returns nil when it does not find the snippet' do + expect(described_class.find_snippet('@@unexisting/path/to/snippet')).to be_nil + end + end +end |