diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index ee0f7c5f0..83bff5542 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -14,7 +14,7 @@ class SchemesController < ApplicationController @total_count = all_schemes.size end - private +private def search_term params["search"] diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index f8bc2c2da..3f2e58d0b 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -59,11 +59,11 @@ RSpec.describe SchemesController, type: :request do end context "when paginating over 20 results" do - let!(:other_schemes) { FactoryBot.create_list(:scheme, 20) } let(:total_schemes_count) { Scheme.count } context "when on the first page" do before do + FactoryBot.create_list(:scheme, 20) get "/supported-housing" end @@ -71,11 +71,6 @@ RSpec.describe SchemesController, type: :request do expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes.") end - it "has pagination links" do - expect(page).to have_content("Next") - expect(page).to have_link("Next") - end - it "shows which schemes are being shown on the current page" do expect(CGI.unescape_html(response.body)).to match("Showing 1 to 20 of #{total_schemes_count} schemes") end @@ -96,6 +91,7 @@ RSpec.describe SchemesController, type: :request do before do get "/supported-housing?page=2" end + it "shows the total schemes count" do expect(CGI.unescape_html(response.body)).to match("#{total_schemes_count} total schemes.") end @@ -144,7 +140,6 @@ RSpec.describe SchemesController, type: :request do context "when signed in as a data coordinator user" do let(:user) { FactoryBot.create(:user, :data_coordinator) } - let!(:same_org_scheme) { FactoryBot.create(:scheme, organisation: user.organisation) } before do sign_in user