Browse Source

add pagination test for organisations page 2, remove second before block

pull/557/head
Kat 3 years ago
parent
commit
5edd52d683
  1. 15
      spec/requests/organisations_controller_spec.rb

15
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("<strong>#{total_organisations_count}</strong> total organisations")
end
end
end
end
end

Loading…
Cancel
Save