Last active
December 11, 2017 02:35
-
-
Save aponcz/c8b8aaba513b330baebb21bba1b96024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
feature "user registration", js: true do | |
let(:registration_page) { Pages::User::RegistrationPage.new } | |
scenario "customer signs in with email and password" do | |
sign_up_with "aponcz@example.com", | |
"password", | |
"password" | |
expect( registration_page ).to have_success_message | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "webmock/rspec" | |
require Rails.root.join("spec/support/pages/page.rb") | |
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f } | |
ActiveRecord::Migration.maintain_test_schema! | |
RSpec.configure do |config| | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pages | |
class Page | |
include Capybara::DSL | |
include Rails.application.routes.url_helpers | |
def poltergeist? | |
Capybara.javascript_driver == :poltergeist | |
end | |
def has_success_message? | |
assert_text "Successfully" | |
end | |
def has_message?(msg) | |
assert_text msg | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pages | |
module User | |
class SigninPage < Page | |
def has_success_message? | |
has_text? I18n.t("devise.sessions.signed_in") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment