|
|
@ -213,7 +213,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
get "/schemes/#{specific_scheme.id}" |
|
|
|
get "/schemes/#{specific_scheme.id}" |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.organisation.name) |
|
|
|
expect(page).to have_content(specific_scheme.owning_organisation.name) |
|
|
|
expect(page).to have_content(specific_scheme.sensitive) |
|
|
|
expect(page).to have_content(specific_scheme.sensitive) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
@ -246,7 +246,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
it "has page heading" do |
|
|
|
it "has page heading" do |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.organisation.name) |
|
|
|
expect(page).to have_content(specific_scheme.owning_organisation.name) |
|
|
|
expect(page).to have_content(specific_scheme.sensitive) |
|
|
|
expect(page).to have_content(specific_scheme.sensitive) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.id_to_display) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
|
expect(page).to have_content(specific_scheme.service_name) |
|
|
@ -551,7 +551,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
it "creates a new scheme for user organisation with valid params" do |
|
|
|
it "creates a new scheme for user organisation with valid params" do |
|
|
|
post "/schemes", params: params |
|
|
|
post "/schemes", params: params |
|
|
|
|
|
|
|
|
|
|
|
expect(Scheme.last.organisation_id).to eq(user.organisation_id) |
|
|
|
expect(Scheme.last.owning_organisation_id).to eq(user.organisation_id) |
|
|
|
expect(Scheme.last.service_name).to eq("testy") |
|
|
|
expect(Scheme.last.service_name).to eq("testy") |
|
|
|
expect(Scheme.last.scheme_type).to eq("Foyer") |
|
|
|
expect(Scheme.last.scheme_type).to eq("Foyer") |
|
|
|
expect(Scheme.last.sensitive).to eq("Yes") |
|
|
|
expect(Scheme.last.sensitive).to eq("Yes") |
|
|
@ -569,7 +569,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
context "when signed in as a support user" do |
|
|
|
context "when signed in as a support user" do |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
let(:params) { { scheme: { service_name: "testy", sensitive: "1", scheme_type: "Foyer", registered_under_care_act: "No", total_units: "1", organisation_id: organisation.id } } } |
|
|
|
let(:params) { { scheme: { service_name: "testy", sensitive: "1", scheme_type: "Foyer", registered_under_care_act: "No", total_units: "1", owning_organisation_id: organisation.id } } } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
@ -585,7 +585,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
it "creates a new scheme for user organisation with valid params" do |
|
|
|
it "creates a new scheme for user organisation with valid params" do |
|
|
|
post "/schemes", params: params |
|
|
|
post "/schemes", params: params |
|
|
|
|
|
|
|
|
|
|
|
expect(Scheme.last.organisation_id).to eq(organisation.id) |
|
|
|
expect(Scheme.last.owning_organisation_id).to eq(organisation.id) |
|
|
|
expect(Scheme.last.service_name).to eq("testy") |
|
|
|
expect(Scheme.last.service_name).to eq("testy") |
|
|
|
expect(Scheme.last.scheme_type).to eq("Foyer") |
|
|
|
expect(Scheme.last.scheme_type).to eq("Foyer") |
|
|
|
expect(Scheme.last.sensitive).to eq("Yes") |
|
|
|
expect(Scheme.last.sensitive).to eq("Yes") |
|
|
@ -605,7 +605,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
it "displays the new page with an error message" do |
|
|
|
it "displays the new page with an error message" do |
|
|
|
post "/schemes", params: params |
|
|
|
post "/schemes", params: params |
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
expect(response).to have_http_status(:unprocessable_entity) |
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.organisation.required")) |
|
|
|
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.owning_organisation.required")) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -974,8 +974,8 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
registered_under_care_act: "No", |
|
|
|
registered_under_care_act: "No", |
|
|
|
total_units: "1", |
|
|
|
total_units: "1", |
|
|
|
page: "details", |
|
|
|
page: "details", |
|
|
|
organisation_id: another_organisation.id, |
|
|
|
owning_organisation_id: another_organisation.id, |
|
|
|
stock_owning_organisation_id: another_organisation.id } } |
|
|
|
managing_organisation_id: another_organisation.id } } |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "renders confirm secondary group after successful update" do |
|
|
|
it "renders confirm secondary group after successful update" do |
|
|
@ -991,8 +991,8 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
expect(scheme_to_update.reload.sensitive).to eq("Yes") |
|
|
|
expect(scheme_to_update.reload.sensitive).to eq("Yes") |
|
|
|
expect(scheme_to_update.reload.registered_under_care_act).to eq("No") |
|
|
|
expect(scheme_to_update.reload.registered_under_care_act).to eq("No") |
|
|
|
expect(scheme_to_update.reload.total_units).to eq(1) |
|
|
|
expect(scheme_to_update.reload.total_units).to eq(1) |
|
|
|
expect(scheme_to_update.reload.organisation_id).to eq(another_organisation.id) |
|
|
|
expect(scheme_to_update.reload.owning_organisation_id).to eq(another_organisation.id) |
|
|
|
expect(scheme_to_update.reload.stock_owning_organisation_id).to eq(another_organisation.id) |
|
|
|
expect(scheme_to_update.reload.managing_organisation_id).to eq(another_organisation.id) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when updating from check answers page" do |
|
|
|
context "when updating from check answers page" do |
|
|
|