The `type: :feature` is automatically detected by RSpec because these tests are inside the `spec/features` folder. Using `feature` re-adds a `type: :feature` to these files, which will result in a conflict when we upgrade to Rails 5.1's system tests. Because of this change, we also need to change `background` to `before` or else these tests will fail.
35 lines
846 B
Ruby
35 lines
846 B
Ruby
require "rails_helper"
|
|
|
|
describe "Admin users" do
|
|
before do
|
|
@admin = create(:administrator)
|
|
@user = create(:user, username: "Jose Luis Balbin")
|
|
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(current_path).to eq(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
|
|
|