From b2c4c183c5a0deddbdcca97bf8d40d04bc8cab5c Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 29 Jun 2022 14:50:37 +0100 Subject: [PATCH] tests for owned_schemes and managed_schemes --- spec/models/organisation_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 11b7954a0..4ddd14a92 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -4,7 +4,7 @@ RSpec.describe Organisation, type: :model do describe "#new" do let(:user) { FactoryBot.create(:user) } let!(:organisation) { user.organisation } - let!(:scheme) { FactoryBot.create(:scheme, organisation:) } + let!(:scheme) { FactoryBot.create(:scheme, organisation: organisation, stock_owning_organisation: organisation) } it "has expected fields" do expect(organisation.attribute_names).to include("name", "phone", "provider_type") @@ -15,7 +15,15 @@ RSpec.describe Organisation, type: :model do end it "has schemes" do - expect(organisation.schemes.first).to eq(scheme) + expect(organisation.managed_schemes.first).to eq(scheme) + end + + it "has schemes" do + expect(organisation.managed_schemes.first).to eq(scheme) + end + + it "has schemes" do + expect(organisation.owned_schemes.first).to eq(scheme) end it "validates provider_type presence" do