diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-08-30 12:49:14 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-08-30 12:49:14 +0300 |
commit | 1bccd36f04f1e1c4efe9155ea9037910c42a3749 (patch) | |
tree | 5fa93f57ef35c07ee4cd9c15480404d15f0c47b3 /spec/views/search | |
parent | b76bc2762a245c61089fae486e61c9fd83d45f95 (diff) |
Improve search result labels
- Use "results" instead of "blobs", "wiki blobs", "snippet blobs"
- Use "comments" instead of "notes"
- Use correct pluralization
- Don't add "1 - 10 of" if there's only one page
Diffstat (limited to 'spec/views/search')
-rw-r--r-- | spec/views/search/_results.html.haml_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/views/search/_results.html.haml_spec.rb b/spec/views/search/_results.html.haml_spec.rb new file mode 100644 index 00000000000..177ade3b700 --- /dev/null +++ b/spec/views/search/_results.html.haml_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'search/_results' do + before do + controller.params[:action] = 'show' + + 3.times { create(:issue) } + + @search_objects = Issue.page(1).per(2) + @scope = 'issues' + @search_term = 'foo' + end + + it 'displays the page size' do + render + + expect(rendered).to have_content('Showing 1 - 2 of 3 issues for "foo"') + end + + context 'when search results do not have a count' do + before do + @search_objects = @search_objects.without_count + end + + it 'does not display the page size' do + render + + expect(rendered).not_to have_content(/Showing .* of .*/) + end + end +end |