@ -94,7 +94,7 @@ class SchemesController < ApplicationController
if @scheme.errors.empty? && @scheme.save
redirect_to scheme_primary_client_group_path(@scheme)
else
if @scheme.errors.any? { |error| error.attribute == :owning_organisation}
if @scheme.errors.any? { |error| error.attribute == :owning_organisation }
@scheme.errors.add(:owning_organisation_id, message: @scheme.errors[:organisation])
@scheme.errors.delete(:owning_organisation)
end
@ -605,7 +605,6 @@ RSpec.describe "Schemes scheme Features" do
context "when I fill in scheme details indicating that supported services provided by a different organisation and I press save I see primary client group section" do
let(:scheme) { Scheme.first }
let!(:another_organisation) { FactoryBot.create(:organisation, name: "Another Org") }
before do
fill_in_and_save_scheme_details({ "housing_stock_owners" => "Another registered stock owner" })
@ -647,7 +647,7 @@ RSpec.describe SchemesController, type: :request do
it "does not allow the scheme to be confirmed" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
@ -10,7 +10,6 @@ RSpec.describe Imports::SchemeImportService do
let(:scheme_id) { "6d6d7618b58affe2a150a5ef2e9f4765fa6cd05d" }
let!(:owning_org) { FactoryBot.create(:organisation, old_org_id: "7c5bd5fb549c09z2c55d9cb90d7ba84927e64618") }
let!(:managing_org) { FactoryBot.create(:organisation, old_visible_id: "456") }
def open_file(directory, filename)
File.open("#{directory}/#{filename}.xml")