|
|
|
@ -492,11 +492,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
|
|
|
|
|
|
|
|
context "when the organisation id param is included" do |
|
|
|
context "when the organisation id param is included" do |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:params) do |
|
|
|
let(:params) { { scheme: { owning_organisation: organisation } } } |
|
|
|
{ scheme: { |
|
|
|
|
|
|
|
owning_organisation: organisation, |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets the owning organisation correctly" do |
|
|
|
it "sets the owning organisation correctly" do |
|
|
|
post "/schemes", params: params |
|
|
|
post "/schemes", params: params |
|
|
|
@ -602,11 +598,7 @@ RSpec.describe SchemesController, type: :request do |
|
|
|
|
|
|
|
|
|
|
|
context "when organisation id param refers to a non-stock-owning organisation" do |
|
|
|
context "when organisation id param refers to a non-stock-owning organisation" do |
|
|
|
let(:organisation_which_does_not_own_stock) { FactoryBot.create(:organisation, holds_own_stock: false) } |
|
|
|
let(:organisation_which_does_not_own_stock) { FactoryBot.create(:organisation, holds_own_stock: false) } |
|
|
|
let(:params) do |
|
|
|
let(:params) { { scheme: { owning_organisation_id: organisation_which_does_not_own_stock.id } } } |
|
|
|
{ scheme: { |
|
|
|
|
|
|
|
owning_organisation_id: organisation_which_does_not_own_stock.id, |
|
|
|
|
|
|
|
} } |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays the new page with an error message" do |
|
|
|
it "displays the new page with an error message" do |
|
|
|
post "/schemes", params: params |
|
|
|
post "/schemes", params: params |
|
|
|
|