From 568369d8e5baed1f64c734cd403e50a335648e02 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Fri, 26 Nov 2021 18:06:37 +0000 Subject: [PATCH] Update spec --- spec/models/organisation_spec.rb | 4 ++-- spec/models/user_spec.rb | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index b6414ac8e..2c2363c47 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -2,8 +2,8 @@ require "rails_helper" RSpec.describe Organisation, type: :model do describe "#new" do - let!(:user) { FactoryBot.create(:user) } - let(:organisation) { Organisation.first } + let(:user) { FactoryBot.create(:user) } + let(:organisation) { user.organisation } it "has expected fields" do expect(organisation.attribute_names).to include("name", "phone", "org_type") diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 999931a6c..21ae656c9 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3,10 +3,9 @@ require "rails_helper" RSpec.describe User, type: :model do describe "#new" do let(:user) { FactoryBot.create(:user) } - let(:organisation) { Organisation.first } it "belongs to an organisation" do - expect(user.organisation).to eq(organisation) + expect(user.organisation).to be_a(Organisation) end end end