From cea9f6731430dac7f1357abf3790bbc53aecfb8c Mon Sep 17 00:00:00 2001 From: JG Date: Mon, 18 Jul 2022 12:07:20 +0100 Subject: [PATCH] rebase --- app/controllers/schemes_controller.rb | 6 +++++- app/views/users/new.html.erb | 2 +- db/schema.rb | 1 + spec/features/schemes_spec.rb | 9 ++++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 4a35e9357..55dede8e4 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -100,7 +100,11 @@ private def validation_errors(scheme_params) scheme_params.each_key do |key| - @scheme.errors.add(key.to_sym) if scheme_params[key].to_s.empty? + if key == "support_services_provider" + @scheme.errors.add("support_services_provider_before_type_cast".to_sym) if scheme_params[key].to_s.empty? + else + @scheme.errors.add(key.to_sym) if scheme_params[key].to_s.empty? + end end end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 2b3db667e..1965da4a2 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -15,7 +15,7 @@ <%= f.govuk_text_field :name, autocomplete: "name", - label: { text: "Name (optional)", size: "m" } %> + label: { text: "Location name (optional)", size: "m" } %> <%= f.govuk_email_field :email, label: { text: "Email address", size: "m" }, diff --git a/db/schema.rb b/db/schema.rb index 096056489..39bb14d87 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -322,6 +322,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_07_15_133937) do t.integer "old_visible_id" t.integer "total_units" t.integer "support_services_provider" + t.integer "support_services_provider_for_coordinator" t.index ["managing_organisation_id"], name: "index_schemes_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_schemes_on_owning_organisation_id" end diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 946f2f8f5..049916ce5 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -400,7 +400,7 @@ RSpec.describe "Schemes scheme Features" do context "when I add location to the scheme" do before do fill_in "Postcode", with: "SW1P 4DF" - fill_in "Name (optional)", with: "Some name" + fill_in "Location name (optional)", with: "Some name" fill_in "Total number of units at this location", with: 1 choose "Self-contained house" choose "location-wheelchair-adaptation-no-field" @@ -433,7 +433,7 @@ RSpec.describe "Schemes scheme Features" do before do click_link "Add a location" fill_in "Postcode", with: "XX1 1XX" - fill_in "Name (optional)", with: "Other name" + fill_in "Location name (optional)", with: "Other name" fill_in "Total number of units at this location", with: 2 choose "Self-contained house" choose "location-wheelchair-adaptation-no-field" @@ -520,7 +520,6 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_content scheme.id_to_display expect(page).to have_content scheme.service_name expect(page).to have_content scheme.owning_organisation.name - expect(page).to have_content scheme.managing_organisation.name expect(page).to have_content "#{scheme.owning_organisation.name} has been created." end end @@ -697,7 +696,7 @@ RSpec.describe "Schemes scheme Features" do context "when I add location to the scheme" do before do fill_in "Postcode", with: "SW1P 4DF" - fill_in "Name (optional)", with: "Some name" + fill_in "Location name (optional)", with: "Some name" fill_in "Total number of units at this location", with: 1 choose "Self-contained house" choose "location-wheelchair-adaptation-no-field" @@ -730,7 +729,7 @@ RSpec.describe "Schemes scheme Features" do before do click_link "Add a location" fill_in "Postcode", with: "XX1 1XX" - fill_in "Name (optional)", with: "Other name" + fill_in "Location name (optional)", with: "Other name" fill_in "Total number of units at this location", with: 2 choose "Self-contained house" choose "location-wheelchair-adaptation-no-field"