Hides budget polls in polls admin index

This commit is contained in:
María Checa
2018-06-08 14:58:47 +02:00
committed by Javi Martín
parent f6739dc7e5
commit acb0a6070e
2 changed files with 20 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
before_action :load_geozones, only: [:new, :create, :edit, :update]
def index
@polls = Poll.order(starts_at: :desc)
@polls = Poll.not_budget.order(starts_at: :desc)
end
def show

View File

@@ -0,0 +1,19 @@
require "rails_helper"
feature "Polls" do
context "Admin index" do
it "Budget polls should not appear in the list" do
login_as(create(:administrator).user)
poll = create(:poll)
budget_poll = create(:poll, budget: create(:budget))
visit admin_polls_path
expect(page).to have_content(poll.name)
expect(page).not_to have_content(budget_poll.name)
end
end
end