Browse Source

rubocop

pull/648/head
JG 3 years ago
parent
commit
56493675da
  1. 2
      app/controllers/schemes_controller.rb
  2. 9
      spec/requests/schemes_controller_spec.rb

2
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"]

9
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("<strong>#{total_schemes_count}</strong> 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 <b>1</b> to <b>20</b> of <b>#{total_schemes_count}</b> 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("<strong>#{total_schemes_count}</strong> 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

Loading…
Cancel
Save