diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 790d83684..67d3359dd 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -317,15 +317,12 @@ RSpec.describe OrganisationsController, type: :request do end context "when there are more than 20 organisations" do - before do - FactoryBot.create_list(:organisation, 25) - end - let(:support_user) { FactoryBot.create(:user, :support) } let(:total_organisations_count) { Organisation.all.count } before do + FactoryBot.create_list(:organisation, 25) allow(support_user).to receive(:need_two_factor_authentication?).and_return(false) sign_in support_user get "/organisations" @@ -347,6 +344,16 @@ RSpec.describe OrganisationsController, type: :request do expect(page).to have_title("Organisations (page 1 of 2)") end end + + context "when on the second page" do + before do + get "/organisations?page=2", headers:, params: {} + end + + it "shows the total organisations count" do + expect(CGI.unescape_html(response.body)).to match("#{total_organisations_count} total organisations") + end + end end end end