Sha256: ec2885ab07e810da421b709bbe1e29caec0c6cad2b764fc6febfe131a353ef1d

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Auth log in", type: :feature do
  describe "with valid credentials" do
    it "is successful" do
      create(:user, email: "me@example.com", password: "password")

      visit "/account/login"

      fill_in_login_form_with("me@example.com", "password")
      click_button "Log in"

      expect(page).to have_content("Signed in successfully.")
    end
  end

  describe "with invalid credentials" do
    it "fails with unknown user credentials" do
      visit "/account/login"

      fill_in_login_form_with("me@example.com", "password")
      click_button "Log in"

      expect(page).to have_content("Invalid Email or password.")
    end

    it "fails with invalid email" do
      create(:user, email: "me@example.com", password: "password")

      visit "/account/login"

      fill_in_login_form_with("not_me@example.com", "password")
      click_button "Log in"

      expect(page).to have_content("Invalid Email or password.")
    end

    it "fails with invalid password" do
      create(:user, email: "me@example.com", password: "password")

      visit "/account/login"

      fill_in_login_form_with("me@example.com", "bad_password")
      click_button "Log in"

      expect(page).to have_content("Invalid Email or password.")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/features/auth/log_in/log_in_spec.rb