Files
grecia/spec/system/admin/debates_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

23 lines
515 B
Ruby

require "rails_helper"
describe "Admin debates", :admin do
it_behaves_like "flaggable", :debate, admin: true
scenario "Index" do
create(:debate, title: "Best beaches")
visit admin_root_path
within("#side_menu") { click_link "Debates" }
expect(page).to have_content "Best beaches"
end
scenario "Show debate" do
debate = create(:debate)
visit admin_debate_path(debate)
expect(page).to have_content(debate.title)
expect(page).to have_content(debate.description)
end
end