|
|
|
@ -110,6 +110,52 @@ RSpec.describe SchemesHelper do
|
|
|
|
|
let(:support_user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let(:coordinator_user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
|
|
|
|
|
context "when scheme has no locations" do |
|
|
|
|
it "returns correct display attributes for a support user" do |
|
|
|
|
attributes = [ |
|
|
|
|
{ name: "Scheme code", value: "S#{scheme.id}" }, |
|
|
|
|
{ name: "Name", value: "Test service_name", edit: true }, |
|
|
|
|
{ name: "Confidential information", value: "No", edit: true }, |
|
|
|
|
{ name: "Type of scheme", value: "Housing for older people" }, |
|
|
|
|
{ name: "Registered under Care Standards Act 2000", value: "Yes – registered care home providing personal care" }, |
|
|
|
|
{ name: "Housing stock owned by", value: "Acme LTD Owning", edit: true }, |
|
|
|
|
{ name: "Support services provided by", value: "A registered charity or voluntary organisation" }, |
|
|
|
|
{ name: "Primary client group", value: "Rough sleepers" }, |
|
|
|
|
{ name: "Has another client group", value: "Yes" }, |
|
|
|
|
{ name: "Secondary client group", value: "Refugees (permanent)" }, |
|
|
|
|
{ name: "Level of support given", value: "High level" }, |
|
|
|
|
{ name: "Intended length of stay", value: "Permanent" }, |
|
|
|
|
{ name: "Availability", value: "Active from 1 April 2022" }, |
|
|
|
|
{ name: "Status", value: status_tag(:incomplete) }, |
|
|
|
|
] |
|
|
|
|
expect(display_scheme_attributes(scheme, support_user)).to eq(attributes) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns correct display attributes for a coordinator user" do |
|
|
|
|
attributes = [ |
|
|
|
|
{ name: "Scheme code", value: "S#{scheme.id}" }, |
|
|
|
|
{ name: "Name", value: "Test service_name", edit: true }, |
|
|
|
|
{ name: "Confidential information", value: "No", edit: true }, |
|
|
|
|
{ name: "Type of scheme", value: "Housing for older people" }, |
|
|
|
|
{ name: "Registered under Care Standards Act 2000", value: "Yes – registered care home providing personal care" }, |
|
|
|
|
{ name: "Support services provided by", value: "A registered charity or voluntary organisation" }, |
|
|
|
|
{ name: "Primary client group", value: "Rough sleepers" }, |
|
|
|
|
{ name: "Has another client group", value: "Yes" }, |
|
|
|
|
{ name: "Secondary client group", value: "Refugees (permanent)" }, |
|
|
|
|
{ name: "Level of support given", value: "High level" }, |
|
|
|
|
{ name: "Intended length of stay", value: "Permanent" }, |
|
|
|
|
{ name: "Availability", value: "Active from 1 April 2022" }, |
|
|
|
|
{ name: "Status", value: status_tag(:incomplete) }, |
|
|
|
|
] |
|
|
|
|
expect(display_scheme_attributes(scheme, coordinator_user)).to eq(attributes) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when scheme has a location" do |
|
|
|
|
before do |
|
|
|
|
FactoryBot.create(:location, scheme:) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns correct display attributes for a support user" do |
|
|
|
|
attributes = [ |
|
|
|
|
{ name: "Scheme code", value: "S#{scheme.id}" }, |
|
|
|
@ -272,4 +318,5 @@ RSpec.describe SchemesHelper do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|