added more possible photo associations in photo model spec

This commit is contained in:
Brenda Wallace
2019-07-12 15:13:10 +12:00
committed by always-be-closing[bot]
parent 32695e3241
commit b1ebf67960

View File

@@ -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