Browse Source

tests: add tests for add housing provider page

pull/954/head
natdeanlewissoftwire 3 years ago
parent
commit
7f34602566
  1. 9
      spec/requests/organisations_controller_spec.rb

9
spec/requests/organisations_controller_spec.rb

@ -288,7 +288,7 @@ RSpec.describe OrganisationsController, type: :request do
context "with an organisation that the user belongs to" do
let!(:housing_provider) { FactoryBot.create(:organisation) }
let!(:other_org_housing_provider) { FactoryBot.create(:organisation, name: "Foobar LTD") }
let!(:other_organisation) { FactoryBot.create(:organisation, name: "Foobar LTD") }
let!(:other_organisation) { FactoryBot.create(:organisation, name: "Foobar LTD 2") }
before do
FactoryBot.create(:organisation_relationship, child_organisation: organisation, parent_organisation: housing_provider, relationship_type: OrganisationRelationship.relationship_types[:owning])
@ -319,7 +319,6 @@ RSpec.describe OrganisationsController, type: :request do
it "shows the pagination count" do
expect(page).to have_content("1 total housing providers")
end
end
context "when adding a housing provider" do
before do
@ -329,8 +328,14 @@ RSpec.describe OrganisationsController, type: :request do
it "has the correct header" do
expect(response.body).to include("What is the name of your housing provider?")
end
it "shows an add button" do
expect(page).to have_button("Add")
end
end
end
context "with an organisation that are not in scope for the user, i.e. that they do not belong to" do
before do
get "/organisations/#{unauthorised_organisation.id}/housing-providers", headers:, params: {}

Loading…
Cancel
Save