# frozen_string_literal: true

require 'application_system_test_case'

class SignUpTest < ApplicationSystemTestCase
  test 'successful sign up' do
    visit root_path

    click_on 'Sign in'
    click_on 'Sign up'

    assert_title 'Sign Up'

    fill_in 'Email', with: 'volmer@example.com'
    fill_in 'Password', with: 'abc123word'

    click_on 'Sign up'

    assert_title 'Articles'
    within '.navbar' do
      assert_link 'volmer@example.com'
    end
  end

  test 'all fields are required' do
    visit root_path

    click_on 'Sign in'
    click_on 'Sign up'

    click_on 'Sign up'

    assert_title 'Sign Up'

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