Sha256: 0ed57b37d10077bac88eb7ba8db025de2a2830945ee43533d466463e8145cd3c

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'application_system_test_case'

class SignInTest < ApplicationSystemTestCase
  test 'successful sign in' do
    sign_in

    assert_title 'Articles'

    within '.navbar' do
      assert_link 'existing@example.com'
    end
  end

  test 'all fields are required' do
    visit root_path

    click_link 'Sign in'
    click_button 'Sign in'

    assert_title 'Sign In'

    assert_text "Email can't be blank"
    assert_text "Password can't be blank"
  end

  test 'sign in fails when email is incorrect' do
    visit root_path

    click_link 'Sign in'

    fill_in 'Email', with: 'wrong@example.com'
    fill_in 'Password', with: '123xyz'

    click_button 'Sign in'

    assert_title 'Sign In'

    assert_text 'Invalid email or password'
  end

  test 'sign in fails when password is incorrect' do
    visit root_path

    click_link 'Sign in'

    fill_in 'Email', with: 'existing@example.com'
    fill_in 'Password', with: 'wrong'

    click_button 'Sign in'

    assert_title 'Sign In'

    assert_text 'Invalid email or password'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upgrow-0.0.5 test/system/sign_in_test.rb
upgrow-0.0.4 test/system/sign_in_test.rb
upgrow-0.0.3 test/system/sign_in_test.rb