Hides budget polls in polls public index

This commit is contained in:
María Checa
2018-06-08 14:59:07 +02:00
committed by Javi Martín
parent acb0a6070e
commit 22727a9876
2 changed files with 13 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ class PollsController < ApplicationController
::Poll::Answer # trigger autoload
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
def show

View File

@@ -2,6 +2,18 @@ require "rails_helper"
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
it "Budget polls should not appear in the list" do
login_as(create(:administrator).user)