- <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", filters_count: applied_filters_count(@filter_type))) %>
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "log", filters_count: applied_filters_count(@filter_type))) %>
<% if logs&.any? %>
<%= govuk_link_to "Download (CSV)", csv_download_url, type: "text/csv", class: "govuk-!-margin-right-4", style: "white-space: nowrap" %>
<% if @current_user.support? %>
diff --git a/app/views/logs/index.html.erb b/app/views/logs/index.html.erb
index f142a2580..c51466097 100644
--- a/app/views/logs/index.html.erb
+++ b/app/views/logs/index.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "logs") %>
+<% item_label = format_label(@pagy.count, "log") %>
<% title = format_title(@searched, "#{log_type_for_controller(controller).capitalize} logs", current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>
diff --git a/app/views/logs/update_logs.html.erb b/app/views/logs/update_logs.html.erb
index 1ab1fa31c..985adecf3 100644
--- a/app/views/logs/update_logs.html.erb
+++ b/app/views/logs/update_logs.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "logs") %>
+<% item_label = format_label(@pagy.count, "log") %>
<% title = "Update logs" %>
<% content_for :title, title %>
diff --git a/app/views/organisation_relationships/managing_agents.html.erb b/app/views/organisation_relationships/managing_agents.html.erb
index 726533e53..d09056d86 100644
--- a/app/views/organisation_relationships/managing_agents.html.erb
+++ b/app/views/organisation_relationships/managing_agents.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "managing agents") %>
+<% item_label = format_label(@pagy.count, "managing agent") %>
<% if current_user.support? %>
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
@@ -44,7 +44,7 @@
pagy: @pagy,
searched: @searched,
item_label:,
- search_item: "managing agents",
+ search_item: "managing agent",
total_count: @total_count,
remove_path: ->(org_id) { managing_agents_remove_organisation_path(target_organisation_id: org_id) },
} %>
diff --git a/app/views/organisation_relationships/stock_owners.html.erb b/app/views/organisation_relationships/stock_owners.html.erb
index 41b7af06d..3bbba6bf8 100644
--- a/app/views/organisation_relationships/stock_owners.html.erb
+++ b/app/views/organisation_relationships/stock_owners.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "stock owners") %>
+<% item_label = format_label(@pagy.count, "stock owner") %>
<% if current_user.support? %>
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<%= render SubNavigationComponent.new(items: secondary_items(request.path, @organisation.id)) %>
@@ -41,7 +41,7 @@
pagy: @pagy,
searched: @searched,
item_label:,
- search_item: "stock owners",
+ search_item: "stock owner",
total_count: @total_count,
remove_path: ->(org_id) { stock_owners_remove_organisation_path(target_organisation_id: org_id) },
} %>
diff --git a/app/views/organisations/_organisation_list.html.erb b/app/views/organisations/_organisation_list.html.erb
index 67cc9c7a3..16309a5eb 100644
--- a/app/views/organisations/_organisation_list.html.erb
+++ b/app/views/organisations/_organisation_list.html.erb
@@ -1,7 +1,7 @@
<%= govuk_table do |table| %>
<%= table.with_caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
- <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "organisations", filters_count: applied_filters_count(@filter_type))) %>
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "organisation", filters_count: applied_filters_count(@filter_type))) %>
<% end %>
<%= table.with_head do |head| %>
<%= head.with_row do |row| %>
diff --git a/app/views/organisations/index.html.erb b/app/views/organisations/index.html.erb
index 411d792c1..1de12ab77 100644
--- a/app/views/organisations/index.html.erb
+++ b/app/views/organisations/index.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "organisations") %>
+<% item_label = format_label(@pagy.count, "organisation") %>
<% title = format_title(@searched, "Organisations", current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>
diff --git a/app/views/organisations/logs.html.erb b/app/views/organisations/logs.html.erb
index e172a76a9..e318ff6ee 100644
--- a/app/views/organisations/logs.html.erb
+++ b/app/views/organisations/logs.html.erb
@@ -1,4 +1,4 @@
-<% item_label = format_label(@pagy.count, "logs") %>
+<% item_label = format_label(@pagy.count, "log") %>
<% title = format_title(@searched, action_name.humanize, current_user, item_label, @pagy.count, @organisation.name) %>
<% content_for :title, title %>
diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb
index 967295236..1c11e86d1 100644
--- a/app/views/schemes/_scheme_list.html.erb
+++ b/app/views/schemes/_scheme_list.html.erb
@@ -2,7 +2,7 @@
<%= govuk_table do |table| %>
<%= table.with_caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
- <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "schemes", filters_count: applied_filters_count(@filter_type))) %>
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "scheme", filters_count: applied_filters_count(@filter_type))) %>
<% if @schemes&.any? %>
<%= govuk_link_to "Download schemes (CSV)", schemes_csv_download_url, type: "text/csv", class: "govuk-!-margin-right-4", style: "white-space: nowrap" %>
<%= govuk_link_to "Download locations (CSV)", locations_csv_download_url, type: "text/csv", class: "govuk-!-margin-right-4", style: "white-space: nowrap" %>
diff --git a/app/views/users/_user_list.html.erb b/app/views/users/_user_list.html.erb
index 436c0def2..82a82b33b 100644
--- a/app/views/users/_user_list.html.erb
+++ b/app/views/users/_user_list.html.erb
@@ -1,7 +1,7 @@
<%= govuk_table do |table| %>
<%= table.with_caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
- <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "users", filters_count: applied_filters_count(@filter_type))) %>
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "user", filters_count: applied_filters_count(@filter_type))) %>
<% if current_user.support? %>
<% query = searched.present? ? "?search=#{searched}" : nil %>
<%= govuk_link_to "Download (CSV)", "#{request.path}.csv#{query}", type: "text/csv", style: "white-space: nowrap" %>
diff --git a/spec/components/search_result_caption_component_spec.rb b/spec/components/search_result_caption_component_spec.rb
index 25cbc1bdd..ba892323d 100644
--- a/spec/components/search_result_caption_component_spec.rb
+++ b/spec/components/search_result_caption_component_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
let(:count) { 2 }
let(:item_label) { "user" }
let(:total_count) { 3 }
- let(:item) { "schemes" }
+ let(:item) { "scheme" }
let(:filters_count) { 1 }
let(:result) { render_inline(described_class.new(searched:, count:, item_label:, total_count:, item:, filters_count:)) }
@@ -21,6 +21,14 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
it "renders table caption including the search results and total" do
expect(result.to_html).to eq("\n 2 users matching search
\n\n")
end
+
+ context "with 1 result" do
+ let(:count) { 1 }
+
+ it "renders table caption including the search results and total" do
+ expect(result.to_html).to eq("\n 1 user matching search
\n\n")
+ end
+ end
end
context "when filter results are found" do
@@ -29,6 +37,14 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
it "renders table caption including the search results and total" do
expect(result.to_html).to eq("\n 2 users matching filters
\n\n")
end
+
+ context "with 1 result" do
+ let(:count) { 1 }
+
+ it "renders table caption including the search results and total" do
+ expect(result.to_html).to eq("\n 1 user matching filters
\n\n")
+ end
+ end
end
context "when no search/filter is applied" do
@@ -38,6 +54,13 @@ RSpec.describe SearchResultCaptionComponent, type: :component do
it "renders table caption with total count only" do
expect(result.to_html).to eq("\n \n 2 total schemes\n \n\n")
end
+
+ context "with 1 result" do
+ let(:count) { 1 }
+ it "renders table caption with total count only" do
+ expect(result.to_html).to eq("\n \n 1 total scheme\n \n\n")
+ end
+ end
end
context "when nothing is found" do