Files
nairobi/spec/system/admin/poll/officers_spec.rb
Javi Martín 9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00

35 lines
784 B
Ruby

require "rails_helper"
describe "Admin poll officers" do
let!(:user) { create(:user, username: "Pedro Jose Garcia") }
let!(:officer) { create(:poll_officer) }
before do
login_as(create(:administrator).user)
visit admin_officers_path
end
scenario "Index" do
expect(page).to have_content officer.name
expect(page).to have_content officer.email
expect(page).not_to have_content user.name
end
scenario "Create", :js do
fill_in "email", with: user.email
click_button "Search"
expect(page).to have_content user.name
click_link "Add"
within("#officers") do
expect(page).to have_content user.name
end
end
scenario "Delete" do
click_link "Delete position"
expect(page).not_to have_css "#officers"
end
end