Hides budget polls in polls public index
This commit is contained in:
@@ -11,7 +11,7 @@ class PollsController < ApplicationController
|
|||||||
::Poll::Answer # trigger autoload
|
::Poll::Answer # trigger autoload
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = @polls.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
@polls = @polls.not_budget.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -2,6 +2,18 @@ require "rails_helper"
|
|||||||
|
|
||||||
feature "Polls" do
|
feature "Polls" do
|
||||||
|
|
||||||
|
context "Public index" do
|
||||||
|
it "Budget polls should not be listed" do
|
||||||
|
poll = create(:poll)
|
||||||
|
budget_poll = create(:poll, budget: create(:budget))
|
||||||
|
|
||||||
|
visit polls_path
|
||||||
|
|
||||||
|
expect(page).to have_content(poll.name)
|
||||||
|
expect(page).not_to have_content(budget_poll.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "Admin index" do
|
context "Admin index" do
|
||||||
it "Budget polls should not appear in the list" do
|
it "Budget polls should not appear in the list" do
|
||||||
login_as(create(:administrator).user)
|
login_as(create(:administrator).user)
|
||||||
|
|||||||
Reference in New Issue
Block a user