expect(page).tohave_title("Your organisation (1 log matching ‘#{log_to_search.id}’ of #{log_total_count} total logs) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("#{organisation.name} (1 log matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
it"shows case logs matching the id"do
it"shows case logs matching the id"do
@ -536,12 +536,12 @@ RSpec.describe OrganisationsController, type: :request do
it"has title with pagination details for page 1"do
it"has title with pagination details for page 1"do
expect(page).tohave_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("#{organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
it"has title with pagination details for page 2"do
it"has title with pagination details for page 2"do
expect(page).tohave_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("#{organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end
end
@ -798,11 +798,11 @@ RSpec.describe OrganisationsController, type: :request do
end
end
it"updates the table caption"do
it"updates the table caption"do
expect(page).tohave_content("1 organisation found matching ‘#{search_param}’ of 29 total organisations.")
expect(page).tohave_content("1 organisation found matching ‘#{search_param}’")
end
end
it"has search in the title"do
it"has search in the title"do
expect(page).tohave_title("Organisations (1 organisation matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("Organisations (1 organisation matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
context"when the search term matches more than 1 result"do
context"when the search term matches more than 1 result"do
@ -814,11 +814,11 @@ RSpec.describe OrganisationsController, type: :request do
end
end
it"updates the table caption"do
it"updates the table caption"do
expect(page).tohave_content("2 organisations found matching ‘#{search_param}’ of 29 total organisations.")
expect(page).tohave_content("2 organisations found matching ‘#{search_param}’")
end
end
it"has search in the title"do
it"has search in the title"do
expect(page).tohave_title("Organisations (2 organisations matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("Organisations (2 organisations matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end
end
@ -826,7 +826,7 @@ RSpec.describe OrganisationsController, type: :request do
let(:search_param){"DLUHC"}
let(:search_param){"DLUHC"}
it"has search and pagination in the title"do
it"has search and pagination in the title"do
expect(page).tohave_title("Organisations (27 organisations matching ‘#{search_param}’ of 29 total organisations) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_title("Organisations (27 organisations matching ‘#{search_param}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end
end
end
end
@ -877,118 +877,6 @@ RSpec.describe OrganisationsController, type: :request do
request
request
expect(response).toredirect_to("/organisations")
expect(response).toredirect_to("/organisations")
end
end
it"has a sub-navigation with correct tabs"do
expect(page).tohave_css(".app-sub-navigation")
expect(page).tohave_content("About this organisation")
end
it"allows to edit the organisation details"do
expect(page).tohave_link("Change",count:3)
end
end
end
context"when there are more than 20 organisations"do
it"shows which organisations are being shown on the current page"do
expect(CGI.unescape_html(response.body)).tomatch("Showing <b>1</b> to <b>20</b> of <b>#{total_organisations_count}</b> organisations")
end
it"has pagination in the title"do
expect(page).tohave_title("Organisations (page 1 of 2)")
end
end
context"when on the second page"do
beforedo
get"/organisations?page=2",headers:,params:{}
end
it"shows the total organisations count"do
expect(CGI.unescape_html(response.body)).tomatch("<strong>#{total_organisations_count}</strong> total organisations.")
end
it"has pagination links"do
expect(page).tohave_content("Previous")
expect(page).tohave_link("Previous")
expect(page).tohave_content("Next")
expect(page).not_tohave_link("Next")
end
it"shows which logs are being shown on the current page"do
expect(CGI.unescape_html(response.body)).tomatch("Showing <b>21</b> to <b>#{total_organisations_count}</b> of <b>#{total_organisations_count}</b> organisations")
end
it"has pagination in the title"do
expect(page).tohave_title("Organisations (page 2 of 2)")
expect(page).tohave_content("2 organisations found matching ‘#{search_param}’ of 29 total organisations.")
end
it"has search in the title"do
expect(page).tohave_title("Organisations (2 organisations matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
context"when search results require pagination"do
let(:search_param){"DLUHC"}
it"has search and pagination in the title"do
expect(page).tohave_title("Organisations (27 organisations matching ‘#{search_param}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")