diff options
Diffstat (limited to 'spec/lib/gitlab/snippet_search_results_spec.rb')
-rw-r--r-- | spec/lib/gitlab/snippet_search_results_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/snippet_search_results_spec.rb b/spec/lib/gitlab/snippet_search_results_spec.rb index b661a894c0c..35df38f052b 100644 --- a/spec/lib/gitlab/snippet_search_results_spec.rb +++ b/spec/lib/gitlab/snippet_search_results_spec.rb @@ -16,4 +16,22 @@ describe Gitlab::SnippetSearchResults do expect(results.snippet_blobs_count).to eq(1) end end + + describe '#formatted_count' do + using RSpec::Parameterized::TableSyntax + + where(:scope, :count_method, :expected) do + 'snippet_titles' | :snippet_titles_count | '1234' + 'snippet_blobs' | :snippet_blobs_count | '1234' + 'projects' | :limited_projects_count | '1000+' + 'unknown' | nil | nil + end + + with_them do + it 'returns the expected formatted count' do + expect(results).to receive(count_method).and_return(1234) if count_method + expect(results.formatted_count(scope)).to eq(expected) + end + end + end end |