Replace incoming filter on dashboard polls
Add starts_at attribute intead of incoming because this scope doesn't exists anymore.
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="small-12 column small-centered margin-top">
|
<div class="small-12 column small-centered margin-top">
|
||||||
<% if poll.incoming? %>
|
<% if poll.starts_at.to_date >= Date.current %>
|
||||||
<%= link_to t("dashboard.polls.poll.edit_poll"),
|
<%= link_to t("dashboard.polls.poll.edit_poll"),
|
||||||
edit_proposal_dashboard_poll_path(proposal, poll), class: "button hollow" %>
|
edit_proposal_dashboard_poll_path(proposal, poll), class: "button hollow" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ feature "Polls" do
|
|||||||
expect(page).to have_content("New poll")
|
expect(page).to have_content("New poll")
|
||||||
end
|
end
|
||||||
|
|
||||||
poll = create(:poll, :incoming, related: proposal)
|
|
||||||
scenario "Edit poll is allowed for upcoming polls" do
|
scenario "Edit poll is allowed for upcoming polls" do
|
||||||
|
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
|
||||||
|
|
||||||
visit proposal_dashboard_polls_path(proposal)
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ feature "Polls" do
|
|||||||
expect(page).to have_content "Poll updated successfully"
|
expect(page).to have_content "Poll updated successfully"
|
||||||
end
|
end
|
||||||
|
|
||||||
poll = create(:poll, :incoming, related: proposal)
|
|
||||||
scenario "Edit poll redirects back when invalid data", js: true do
|
scenario "Edit poll redirects back when invalid data", js: true do
|
||||||
|
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
|
||||||
|
|
||||||
visit proposal_dashboard_polls_path(proposal)
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ feature "Polls" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Edit poll should allow to remove questions", :js do
|
scenario "Edit poll should allow to remove questions", :js do
|
||||||
poll = create(:poll, :incoming, related: proposal)
|
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
|
||||||
create(:poll_question, poll: poll)
|
create(:poll_question, poll: poll)
|
||||||
create(:poll_question, poll: poll)
|
create(:poll_question, poll: poll)
|
||||||
visit proposal_dashboard_polls_path(proposal)
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
@@ -128,7 +128,7 @@ feature "Polls" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Edit poll should allow to remove answers", :js do
|
scenario "Edit poll should allow to remove answers", :js do
|
||||||
poll = create(:poll, :incoming, related: proposal)
|
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
|
||||||
question = create(:poll_question, poll: poll)
|
question = create(:poll_question, poll: poll)
|
||||||
create(:poll_question_answer, question: question)
|
create(:poll_question_answer, question: question)
|
||||||
create(:poll_question_answer, question: question)
|
create(:poll_question_answer, question: question)
|
||||||
@@ -153,8 +153,8 @@ feature "Polls" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
poll = create(:poll, :incoming, related: proposal)
|
|
||||||
scenario "View results not available for upcoming polls" do
|
scenario "View results not available for upcoming polls" do
|
||||||
|
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
|
||||||
|
|
||||||
visit proposal_dashboard_polls_path(proposal)
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user