|
|
|
@ -34,6 +34,36 @@ RSpec.describe OrganisationsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when user is signed in" do |
|
|
|
|
describe "#schemes" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:schemes) { FactoryBot.create_list(:scheme, 5) } |
|
|
|
|
let!(:same_org_scheme) { FactoryBot.create(:scheme, organisation: user.organisation) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
get "/organisations/#{organisation.id}/supported-housing", headers:, params: {} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has page heading" do |
|
|
|
|
expect(page).to have_content("Supported housing services") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to the organisation schemes path" do |
|
|
|
|
expect(path).to match("/organisations/#{user.organisation.id}/schemes") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows a search bar" do |
|
|
|
|
expect(page).to have_field("search", type: "search") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows only schemes belonging to the same organisation" do |
|
|
|
|
expect(page).to have_content(same_org_scheme.code) |
|
|
|
|
schemes.each do |scheme| |
|
|
|
|
expect(page).not_to have_content(scheme.code) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#show" do |
|
|
|
|
context "with an organisation that the user belongs to" do |
|
|
|
|
before do |
|
|
|
|