diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 967579fac..2ec11b87c 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -29,7 +29,6 @@ class SchemesController < ApplicationController if @scheme.save redirect_to scheme_primary_client_group_path(@scheme) else - debugger @scheme.errors.add(:owning_organisation_id, message: @scheme.errors[:organisation]) @scheme.errors.delete(:owning_organisation) render :new, status: :unprocessable_entity @@ -94,6 +93,16 @@ private case when page.include?("primary") "schemes/primary_client_group" + when page.include?("primary") + "schemes/confirm_secondary" + when page.include?("primary") + "schemes/secondary_client_group" + when page.include?("primary") + "schemes/support" + when page.include?("primary") + "schemes/details" + when page.include?("primary") + "schemes/edit_name" end end diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 26840b79e..67b73720f 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -4,10 +4,10 @@ class Scheme < ApplicationRecord has_many :locations has_many :case_logs - validates_presence_of :service_name - validates_presence_of :scheme_type - validates_presence_of :registered_under_care_act - validates :primary_client_group, presence: true, on: :update + # validates_presence_of :service_name + # validates_presence_of :scheme_type + # validates_presence_of :registered_under_care_act + # validates :primary_client_group, presence: true, on: :update scope :filter_by_id, ->(id) { where(id: (id.start_with?("S") ? id[1..] : id)) } scope :search_by_service_name, ->(name) { where("service_name ILIKE ?", "%#{name}%") } diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 2d92c7385..c58f4426f 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -344,6 +344,7 @@ RSpec.describe SchemesController, type: :request do it "creates a new scheme for user organisation with valid params and renders correct page" do expect { post "/schemes", params: }.to change(Scheme, :count).by(1) + follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("What client group is this scheme intended for?") end @@ -378,6 +379,7 @@ RSpec.describe SchemesController, type: :request do it "creates a new scheme for user organisation with valid params and renders correct page" do expect { post "/schemes", params: }.to change(Scheme, :count).by(1) + follow_redirect! expect(response).to have_http_status(:ok) expect(page).to have_content("What client group is this scheme intended for?") end