Browse Source

correct return when on org schemes

pull/648/head
JG 3 years ago
parent
commit
2d6e215569
  1. 2
      app/components/search_component.rb
  2. 24
      spec/requests/organisations_controller_spec.rb

2
app/components/search_component.rb

@ -13,6 +13,8 @@ class SearchComponent < ViewComponent::Base
request.path request.path
elsif request.path.include?("organisations") && request.path.include?("logs") elsif request.path.include?("organisations") && request.path.include?("logs")
request.path request.path
elsif request.path.include?("organisations") && request.path.include?("supported-housing")
request.path
elsif request.path.include?("users") elsif request.path.include?("users")
user_path(current_user) user_path(current_user)
elsif request.path.include?("organisations") elsif request.path.include?("organisations")

24
spec/requests/organisations_controller_spec.rb

@ -63,6 +63,30 @@ RSpec.describe OrganisationsController, type: :request do
expect(page).not_to have_content(scheme.code) expect(page).not_to have_content(scheme.code)
end end
end end
context "when searching" do
let!(:searched_scheme) { FactoryBot.create(:scheme, code: "CODE321") }
let(:search_param) { "CODE321" }
before do
get "/organisations/#{organisation.id}/supported-housing?search=#{search_param}"
end
it "returns matching results" do
expect(page).to have_content(searched_scheme.code)
schemes.each do |scheme|
expect(page).not_to have_content(scheme.code)
end
end
it "updates the table caption" do
expect(page).to have_content("1 scheme found matching ‘#{search_param}")
end
it "has search in the title" do
expect(page).to have_title("Supported housing services (1 scheme matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end end
describe "#show" do describe "#show" do

Loading…
Cancel
Save