2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'search/_results' do
|
|
|
|
before do
|
|
|
|
controller.params[:action] = 'show'
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
create_list(:issue, 3)
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
@search_objects = Issue.page(1).per(2)
|
|
|
|
@scope = 'issues'
|
|
|
|
@search_term = 'foo'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'displays the page size' do
|
|
|
|
render
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(rendered).to have_content('Showing 1 - 2 of 3 issues for foo')
|
2019-12-04 20:38:33 +05:30
|
|
|
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
|