diff --git a/app/components/search_result_caption_component.html.erb b/app/components/search_result_caption_component.html.erb index f16cc485e..f2a553828 100644 --- a/app/components/search_result_caption_component.html.erb +++ b/app/components/search_result_caption_component.html.erb @@ -1,7 +1,7 @@ - - <% if searched.present? %> - <%= count %> <%= item_label %> found matching ‘<%= searched %>’ of <%= total_count %> total <%= item %>. <%= govuk_link_to("Clear search", path) %> - <% else %> - <%= count %> total <%= item %>. - <% end %> + + <% if searched.present? %> + <%= count %> <%= item_label %> found matching ‘<%= searched %>’ of <%= total_count %> total <%= item %>. <%= govuk_link_to("Clear search", path) %> + <% else %> + <%= count %> total <%= item %> + <% end %> diff --git a/spec/components/search_result_caption_component_spec.rb b/spec/components/search_result_caption_component_spec.rb index a317e562e..ed4934633 100644 --- a/spec/components/search_result_caption_component_spec.rb +++ b/spec/components/search_result_caption_component_spec.rb @@ -10,7 +10,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do it "renders table caption including the search results and total" do result = render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, path:)) - expect(result.to_html).to eq(" \n #{count} #{item_label} found matching ‘#{searched}’ of #{total_count} total #{item}. Clear search\n\n") + expect(result.to_html).to eq("\n #{count} #{item_label} found matching ‘#{searched}’ of #{total_count} total #{item}. Clear search\n\n") end context "when no search results are found" do @@ -19,7 +19,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do it "renders table caption with total count only" do result = render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, path:)) - expect(result.to_html).to eq(" \n #{count} total #{item}.\n\n") + expect(result.to_html).to eq("\n #{count} total #{item}\n\n") end end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index e17f140f5..0498209f9 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -892,7 +892,7 @@ RSpec.describe OrganisationsController, type: :request do end it "shows the total organisations count" do - expect(CGI.unescape_html(response.body)).to match("#{total_organisations_count} total organisations.") + expect(CGI.unescape_html(response.body)).to match("#{total_organisations_count} total organisations") end it "has pagination links" do diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 2e853a922..47ba637e3 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -90,7 +90,7 @@ RSpec.describe SchemesController, type: :request do end it "shows the total organisations count" do - expect(CGI.unescape_html(response.body)).to match("#{schemes.count} total schemes.") + expect(CGI.unescape_html(response.body)).to match("#{schemes.count} total schemes") end context "when params scheme_id is present" do @@ -113,7 +113,7 @@ RSpec.describe SchemesController, type: :request do end it "shows the total schemes count" do - expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes.") + expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes") end it "shows which schemes are being shown on the current page" do @@ -138,7 +138,7 @@ RSpec.describe SchemesController, type: :request do end it "shows the total schemes count" do - expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes.") + expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes") end it "has pagination links" do