Hides budget polls in polls admin index
This commit is contained in:
@@ -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
|
||||
|
||||
19
spec/features/budget_polls/polls_spec.rb
Normal file
19
spec/features/budget_polls/polls_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user