Always show create question button on admin proposal show

This commit is contained in:
decabeza
2019-03-13 13:28:12 +01:00
parent e7dd63e264
commit 74958fab02
7 changed files with 37 additions and 11 deletions

View File

@@ -62,13 +62,33 @@ feature "Admin poll questions" do
expect(page).to have_content(title)
end
scenario "Create from successful proposal" do
poll = create(:poll, name: "Proposals")
proposal = create(:proposal, :successful)
scenario "Create from proposal" do
create(:poll, name: "Proposals")
proposal = create(:proposal)
visit admin_proposal_path(proposal)
click_link "Create question"
expect(page).not_to have_content("This proposal has reached the required supports")
click_link "Add this proposal to a poll to be voted"
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
expect(page).to have_field("Question", with: proposal.title)
select "Proposals", from: "poll_question_poll_id"
click_button "Save"
expect(page).to have_content(proposal.title)
end
scenario "Create from successful proposal" do
create(:poll, name: "Proposals")
proposal = create(:proposal, :successful)
visit admin_proposal_path(proposal)
expect(page).to have_content("This proposal has reached the required supports")
click_link "Add this proposal to a poll to be voted"
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
expect(page).to have_field("Question", with: proposal.title)
@@ -78,8 +98,6 @@ feature "Admin poll questions" do
click_button "Save"
expect(page).to have_content(proposal.title)
expect(page).to have_link(proposal.title, href: proposal_path(proposal))
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
end
scenario "Update" do