Sha256: 6ee3366726e3e7bb5dcd73ffc03bdde78a800bdac1523e1410a22a3aba3a35fa

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

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

RSpec.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)
    FactoryBot.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

22 entries across 22 versions & 1 rubygems

Version Path
clearance-2.9.2 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.9.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.9.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.8.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.7.2 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.7.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.6.2 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.6.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.6.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.5.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.4.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.3.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.3.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.2.1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.2.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.1.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.0.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.0.0.beta2 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-2.0.0.beta1 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt
clearance-1.17.0 lib/generators/clearance/specs/templates/features/clearance/visitor_signs_in_spec.rb.tt