Files
nairobi/spec/system/admin/users_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
852 B
Ruby

require "rails_helper"
describe "Admin users" do
let(:admin) { create(:administrator) }
let!(:user) { create(:user, username: "Jose Luis Balbin") }
before do
login_as(admin.user)
visit admin_users_path
end
scenario "Index" do
expect(page).to have_link user.name
expect(page).to have_content user.email
expect(page).to have_content admin.name
expect(page).to have_content admin.email
end
scenario "The username links to their public profile" do
click_link user.name
expect(page).to have_current_path(user_path(user))
end
scenario "Search" do
fill_in :search, with: "Luis"
click_button "Search"
expect(page).to have_content user.name
expect(page).to have_content user.email
expect(page).not_to have_content admin.name
expect(page).not_to have_content admin.email
end
end