FIX: Added test for has_more

This commit is contained in:
venarius 2019-03-09 12:23:46 +01:00 committed by Robin Ward
parent dc4541a95c
commit 411ddbeef0
1 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,13 @@ RSpec.describe Admin::SiteTextsController do
expect(JSON.parse(response.body)['site_texts']).to include(include("id" => "title")) expect(JSON.parse(response.body)['site_texts']).to include(include("id" => "title"))
end end
it 'sets has_more to true if more than 50 results were found' do
get "/admin/customize/site_texts.json", params: { q: 'e' }
expect(response.status).to eq(200)
expect(JSON.parse(response.body)['site_texts'].size).to eq(50)
expect(JSON.parse(response.body)['extras']['has_more']).to be_truthy
end
it 'normalizes quotes during search' do it 'normalizes quotes during search' do
value = %q|“Thats a magic sock.”| value = %q|“Thats a magic sock.”|
put "/admin/customize/site_texts/title.json", params: { site_text: { value: value } } put "/admin/customize/site_texts/title.json", params: { site_text: { value: value } }