Test for displaying plantings on profile page

This commit is contained in:
Brenda Wallace
2019-06-30 13:35:41 +12:00
committed by always-be-closing[bot]
parent 97028bdf1d
commit bf6cb5352d

View File

@@ -102,8 +102,23 @@ describe "member profile", js: true do
end
end
shared_examples 'member activity' do
context 'member has plantings' do
let!(:new_planting) { FactoryBot.create :planting, owner: member, planted_at: Time.zone.now }
let!(:old_planting) { FactoryBot.create :planting, owner: member, planted_at: 3.years.ago }
let!(:finished_planting) { FactoryBot.create :finished_planting, owner: member }
let!(:no_planted_at_planting) { FactoryBot.create :planting, owner: member, planted_at: nil }
before { visit member_path(member) }
it { expect(page).to have_link href: planting_path(new_planting) }
it { expect(page).to have_link href: planting_path(old_planting) }
it { expect(page).to have_link href: planting_path(finished_planting) }
it { expect(page).to have_link href: planting_path(no_planted_at_planting) }
end
end
context "not signed in" do
include_examples 'member details'
include_examples 'member activity'
it "no bio" do
member.update! bio: nil