Browse Source

rebase

pull/730/head
JG 3 years ago
parent
commit
cea9f67314
  1. 6
      app/controllers/schemes_controller.rb
  2. 2
      app/views/users/new.html.erb
  3. 1
      db/schema.rb
  4. 9
      spec/features/schemes_spec.rb

6
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

2
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" },

1
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

9
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"

Loading…
Cancel
Save