From c5fa5a84dc3f7c8c4d2bf480680540479ec0d874 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Thu, 1 Dec 2022 15:24:05 +0000 Subject: [PATCH] test: add test that including owning org does nothing when user is coordinator --- spec/requests/schemes_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index a2877c415..4bf4549c8 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -489,6 +489,20 @@ RSpec.describe SchemesController, type: :request do expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid")) end end + + context "when the organisation id param is included" do + let(:organisation) { FactoryBot.create(:organisation) } + let(:params) do + { scheme: { + owning_organisation_id: organisation.id, + } } + end + + it "sets the owning organisation correctly" do + post "/schemes", params: params + expect(Scheme.last.owning_organisation_id).to eq(user.organisation_id) + end + end end context "when signed in as a support user" do