diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-29 00:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-29 00:09:15 +0300 |
commit | 8831c2df7fa3f1bb567e284e4b8c0a4f441e74b3 (patch) | |
tree | 36b1b430075ff6e63524be14585dbb614e893e8c /spec/models/snippet_spec.rb | |
parent | 1c8fa70f9d0818e2a82089c8643a6e455bca47fd (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 | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb index 1265b95736d..cb7b9961880 100644 --- a/spec/models/snippet_spec.rb +++ b/spec/models/snippet_spec.rb @@ -632,4 +632,26 @@ describe Snippet do end end end + + describe '#can_cache_field?' do + using RSpec::Parameterized::TableSyntax + + let(:snippet) { create(:snippet, file_name: file_name) } + + subject { snippet.can_cache_field?(field) } + + where(:field, :file_name, :result) do + :title | nil | true + :title | 'foo.bar' | true + :description | nil | true + :description | 'foo.bar' | true + :content | nil | false + :content | 'bar.foo' | false + :content | 'markdown.md' | true + end + + with_them do + it { is_expected.to eq result } + end + end end |