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.
13 lines
281 B
Ruby
13 lines
281 B
Ruby
require "rails_helper"
|
|
|
|
describe "Admin comments", :admin do
|
|
scenario "Index" do
|
|
create(:comment, body: "Everything is awesome")
|
|
|
|
visit admin_root_path
|
|
within("#side_menu") { click_link "Comments" }
|
|
|
|
expect(page).to have_content "Everything is awesome"
|
|
end
|
|
end
|