fixes routes for poll's results and stats
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
<% poll.questions.each do |question| %>
|
||||
<h4>
|
||||
<% if poll.results_enabled? %>
|
||||
<%= link_to question.title, poll_results_path(poll) %>
|
||||
<%= link_to question.title, results_poll_path(poll) %>
|
||||
<% elsif poll.stats_enabled? %>
|
||||
<%= link_to question.title, poll_stats_path(poll) %>
|
||||
<%= link_to question.title, stats_poll_path(poll) %>
|
||||
<% else %>
|
||||
<%= link_to question.title, poll %>
|
||||
<% end %>
|
||||
@@ -33,9 +33,9 @@
|
||||
<% else %>
|
||||
<h4>
|
||||
<% if poll.results_enabled? %>
|
||||
<%= link_to poll.name, poll_results_path(poll) %>
|
||||
<%= link_to poll.name, results_poll_path(poll) %>
|
||||
<% elsif poll.stats_enabled? %>
|
||||
<%= link_to poll.name, poll_stats_path(poll) %>
|
||||
<%= link_to poll.name, stats_poll_path(poll) %>
|
||||
<% else %>
|
||||
<%= link_to poll.name, poll %>
|
||||
<% end %>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<h2><%= t("polls.show.results_menu") %></h2>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><%= link_to t("polls.show.results_menu"), poll_results_path(@poll) %></li>
|
||||
<li><%= link_to t("polls.show.results_menu"), results_poll_path(@poll) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<h2><%= t("polls.show.stats_menu") %></h2>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><%= link_to t("polls.show.stats_menu"), poll_stats_path(@poll) %></li>
|
||||
<li><%= link_to t("polls.show.stats_menu"), stats_poll_path(@poll) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -113,8 +113,10 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
resources :polls, only: [:show, :index] do
|
||||
get :stats
|
||||
get :results
|
||||
member do
|
||||
get :stats
|
||||
get :results
|
||||
end
|
||||
resources :questions, controller: 'polls/questions', shallow: true do
|
||||
post :answer, on: :member
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ feature 'Polls' do
|
||||
|
||||
visit polls_path
|
||||
|
||||
expect(page).to have_link("Poll with stats", href: poll_stats_path(poll))
|
||||
expect(page).to have_link("Poll with stats", href: stats_poll_path(poll))
|
||||
end
|
||||
|
||||
scenario "Poll title link to results if enabled" do
|
||||
@@ -73,7 +73,7 @@ feature 'Polls' do
|
||||
|
||||
visit polls_path
|
||||
|
||||
expect(page).to have_link("Poll with results", href: poll_results_path(poll))
|
||||
expect(page).to have_link("Poll with results", href: results_poll_path(poll))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -395,10 +395,10 @@ feature 'Polls' do
|
||||
expect(page).to have_content("Poll results")
|
||||
expect(page).to have_content("Participation statistics")
|
||||
|
||||
visit poll_results_path(poll)
|
||||
visit results_poll_path(poll)
|
||||
expect(page).to have_content("Questions")
|
||||
|
||||
visit poll_stats_path(poll)
|
||||
visit stats_poll_path(poll)
|
||||
expect(page).to have_content("Participation data")
|
||||
end
|
||||
|
||||
@@ -412,10 +412,10 @@ feature 'Polls' do
|
||||
expect(page).to_not have_content("Poll results")
|
||||
expect(page).to_not have_content("Participation statistics")
|
||||
|
||||
visit poll_results_path(poll)
|
||||
visit results_poll_path(poll)
|
||||
expect(page).to have_content("You do not have permission to carry out the action 'results' on poll.")
|
||||
|
||||
visit poll_stats_path(poll)
|
||||
visit stats_poll_path(poll)
|
||||
expect(page).to have_content("You do not have permission to carry out the action 'stats' on poll.")
|
||||
end
|
||||
|
||||
@@ -429,10 +429,10 @@ feature 'Polls' do
|
||||
expect(page).to_not have_content("Poll results")
|
||||
expect(page).to_not have_content("Participation statistics")
|
||||
|
||||
visit poll_results_path(poll)
|
||||
visit results_poll_path(poll)
|
||||
expect(page).to have_content("You do not have permission to carry out the action 'results' on poll.")
|
||||
|
||||
visit poll_stats_path(poll)
|
||||
visit stats_poll_path(poll)
|
||||
expect(page).to have_content("You do not have permission to carry out the action 'stats' on poll.")
|
||||
end
|
||||
|
||||
@@ -446,10 +446,10 @@ feature 'Polls' do
|
||||
expect(page).to have_content("Poll results")
|
||||
expect(page).to have_content("Participation statistics")
|
||||
|
||||
visit poll_results_path(poll)
|
||||
visit results_poll_path(poll)
|
||||
expect(page).to have_content("Questions")
|
||||
|
||||
visit poll_stats_path(poll)
|
||||
visit stats_poll_path(poll)
|
||||
expect(page).to have_content("Participation data")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user