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}’ of 29 total organisations) - 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}’ of 29 total organisations) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")