Add link to proposal if question was created from a proposal

This commit is contained in:
decabeza
2019-03-13 15:35:31 +01:00
parent a2eea842cb
commit b31b65f246
4 changed files with 24 additions and 0 deletions

View File

@@ -14,8 +14,11 @@ feature "Admin poll questions" do
scenario "Index" do
poll1 = create(:poll)
poll2 = create(:poll)
poll3 = create(:poll)
proposal = create(:proposal)
question1 = create(:poll_question, poll: poll1)
question2 = create(:poll_question, poll: poll2)
question3 = create(:poll_question, poll: poll3, proposal: proposal)
visit admin_poll_path(poll1)
expect(page).to have_content(poll1.name)
@@ -36,6 +39,17 @@ feature "Admin poll questions" do
expect(page).to have_content("Edit")
expect(page).to have_content("Delete")
end
visit admin_poll_path(poll3)
expect(page).to have_content(poll3.name)
within("#poll_question_#{question3.id}") do
expect(page).to have_content(question3.title)
expect(page).to have_link("(See proposal)", href: proposal_path(question3.proposal))
expect(page).to have_content("Edit answers")
expect(page).to have_content("Edit")
expect(page).to have_content("Delete")
end
end
scenario "Show" do