- <%= render "govuk_publishing_components/components/#{search_component}", {
+ <%= render "govuk_publishing_components/components/search_with_autocomplete", {
id: "finder-keyword-search",
name: "keywords",
type: 'search',
diff --git a/app/views/search/_search_field.html.erb b/app/views/search/_search_field.html.erb
index 57926801f..be746d153 100644
--- a/app/views/search/_search_field.html.erb
+++ b/app/views/search/_search_field.html.erb
@@ -6,7 +6,7 @@
} %>
<% end %>
-<%= render "govuk_publishing_components/components/#{search_component}", {
+<%= render "govuk_publishing_components/components/search_with_autocomplete", {
inline_label: false,
label_text: label_text,
size: "large",
diff --git a/spec/controllers/finders_controller_spec.rb b/spec/controllers/finders_controller_spec.rb
index 305a64b91..095fc5fa7 100644
--- a/spec/controllers/finders_controller_spec.rb
+++ b/spec/controllers/finders_controller_spec.rb
@@ -251,25 +251,6 @@
expect(response.status).to eq(200)
expect(response).to render_template("finders/show_all_content_finder")
end
-
- describe "search autocomplete" do
- it "renders the search autocomplete when enabled" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
- get :show, params: { slug: "search/all", keywords: "hello" }
-
- expect(response.body).to include("gem-c-search-with-autocomplete")
- end
- end
-
- it "does not render the autocomplete when disabled" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
- get :show, params: { slug: "search/all", keywords: "hello" }
-
- expect(response.body).not_to include("gem-c-search-with-autocomplete")
- expect(response.body).to include("gem-c-search")
- end
- end
- end
end
end
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 849c9b005..743af4fe2 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -36,26 +36,5 @@
expect(response).to redirect_to(destination)
end
end
-
- context "when GOVUK_DISABLE_SEARCH_AUTOCOMPLETE is not set" do
- it "renders the search autocomplete component" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
- get :index
-
- expect(response.body).to include("gem-c-search-with-autocomplete")
- end
- end
- end
-
- context "when GOVUK_DISABLE_SEARCH_AUTOCOMPLETE is set" do
- it "renders the search component instead of the autocomplete component" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
- get :index
-
- expect(response.body).not_to include("gem-c-search-with-autocomplete")
- expect(response.body).to include("gem-c-search")
- end
- end
- end
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
deleted file mode 100644
index 87731781a..000000000
--- a/spec/helpers/application_helper_spec.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require "spec_helper"
-
-RSpec.describe ApplicationHelper, type: :helper do
- describe "#search_component" do
- context "when ENV['GOVUK_DISABLE_SEARCH_AUTOCOMPLETE'] is not set" do
- it "returns 'search_with_autocomplete'" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
- expect(helper.search_component).to eq("search_with_autocomplete")
- end
- end
- end
-
- context "when ENV['GOVUK_DISABLE_SEARCH_AUTOCOMPLETE'] is set" do
- it "returns 'search'" do
- ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
- expect(helper.search_component).to eq("search")
- end
- end
- end
- end
-end