Files
nairobi/spec/system/budget_polls/polls_spec.rb
Javi Martín 3da4ee00b8 Simplify tests requiring admin login
We were repeating the same code over and over (with a few variants) to
setup tests which require an administrator. We can use a tag and
simplify the code.
2020-12-02 15:33:19 +01:00

28 lines
663 B
Ruby

require "rails_helper"
describe "Polls" do
context "Public index" do
scenario "Budget polls should not be listed" do
poll = create(:poll)
budget_poll = create(:poll, :for_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", :admin do
scenario "Budget polls should not appear in the list" do
poll = create(:poll)
budget_poll = create(:poll, :for_budget)
visit admin_polls_path
expect(page).to have_content(poll.name)
expect(page).not_to have_content(budget_poll.name)
end
end
end