Sha256: 79f9fdc15e0d34de13e91c33b55a9d954e5e115e1fd4f94aac14d09d2d515b8d

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

require "<%= @helper_file %>"
require "support/features/clearance_helpers"

feature "Visitor signs in" do
  scenario "with valid email and password" do
    create_user "user@example.com", "password"
    sign_in_with "user@example.com", "password"

    expect_user_to_be_signed_in
  end

  scenario "with valid mixed-case email and password " do
    create_user "user.name@example.com", "password"
    sign_in_with "User.Name@example.com", "password"

    expect_user_to_be_signed_in
  end

  scenario "tries with invalid password" do
    create_user "user@example.com", "password"
    sign_in_with "user@example.com", "wrong_password"

    expect_page_to_display_sign_in_error
    expect_user_to_be_signed_out
  end

  scenario "tries with invalid email" do
    sign_in_with "unknown.email@example.com", "password"

    expect_page_to_display_sign_in_error
    expect_user_to_be_signed_out
  end

  private

  def create_user(email, password)
    FactoryGirl.create(:user, email: email, password: password)
  end

  def expect_page_to_display_sign_in_error
    expect(page.body).to include(
      I18n.t("flashes.failure_after_create", sign_up_path: sign_up_path)
    )
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
clearance-1.12.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.12.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.11.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.10.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.9.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.8.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.8.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.7.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.6.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.6.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.5.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt