測試必須包含 good / bad example
require "rails_helper"
feature "user sign in" do
before do
User.create(email: "[email protected]", password: "password")
end
scenario "good credentials" do
new_session_page.sign_in "[email protected]", "password"
expect(page).to have_text "[email protected]"
end
scenario "bad credentials" do
new_session_page.sign_in "[email protected]", "password"
expect(page).not_to have_text "[email protected]"
end
private
def home_page
PageObjects::Pages::Home.new
end
def navbar
PageObjects::Application::Navbar.new
end
def new_session_page
home_page.go
navbar.sign_in
end
end