From 411ddbeef0e432968908b0185d87fef2d3f7a9f2 Mon Sep 17 00:00:00 2001 From: venarius Date: Sat, 9 Mar 2019 12:23:46 +0100 Subject: [PATCH] FIX: Added test for has_more --- spec/requests/admin/site_texts_controller_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/requests/admin/site_texts_controller_spec.rb b/spec/requests/admin/site_texts_controller_spec.rb index e7703d334ca..878ee5ce1e4 100644 --- a/spec/requests/admin/site_texts_controller_spec.rb +++ b/spec/requests/admin/site_texts_controller_spec.rb @@ -45,6 +45,13 @@ RSpec.describe Admin::SiteTextsController do expect(JSON.parse(response.body)['site_texts']).to include(include("id" => "title")) 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 value = %q|“That’s a ‘magic’ sock.”| put "/admin/customize/site_texts/title.json", params: { site_text: { value: value } }