Skip to content

Instantly share code, notes, and snippets.

@aponcz
Last active December 11, 2017 02:35
Show Gist options
  • Save aponcz/c8b8aaba513b330baebb21bba1b96024 to your computer and use it in GitHub Desktop.
Save aponcz/c8b8aaba513b330baebb21bba1b96024 to your computer and use it in GitHub Desktop.
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
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
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
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