From b1ebf67960841bdf4546686882a775ce820f0723 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 12 Jul 2019 15:13:10 +1200 Subject: [PATCH] added more possible photo associations in photo model spec --- spec/models/photo_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index bbcd2c74b..1729655c4 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -8,7 +8,9 @@ describe Photo do describe 'add/delete functionality' do let(:planting) { FactoryBot.create(:planting, owner: member) } + let(:seed) { FactoryBot.create(:seed, owner: member) } let(:harvest) { FactoryBot.create(:harvest, owner: member) } + let(:post) { FactoryBot.create(:post, author: member) } let(:garden) { FactoryBot.create(:garden, owner: member) } context "adds photos" do @@ -24,11 +26,23 @@ describe Photo do expect(harvest.photos.first).to eq photo end + it 'to a seed' do + seed.photos << photo + expect(seed.photos.size).to eq 1 + expect(seed.photos.first).to eq photo + end + it 'to a garden' do garden.photos << photo expect(garden.photos.size).to eq 1 expect(garden.photos.first).to eq photo end + + it 'to a post' do + post.photos << photo + expect(post.photos.size).to eq 1 + expect(post.photos.first).to eq photo + end end context "removing photos" do