require 'rails_helper'

RSpec.feature "Signing In a user" do
  before do
    @user = User.create!({email:"example@example.com", password:"123456", password_confirmation:"123456"})
  end
  scenario "A user signs up with valid information" do
    visit '/'

    click_link "Sign In"
    fill_in "Email", with: @user.email
    fill_in "Password", with: @user.password

    click_button "Log in"

    expect(page).to have_content("Signed in successfully.")
    expect(page).to have_content("Signed in as #{@user.email}")
    expect(page).not_to have_link("Sign In")
    expect(page).not_to have_link("Sign Up")
  end
  scenario "A user signs up with invalid information" do
    visit '/'

    click_link "Sign In"
    fill_in "Email", with: ""
    fill_in "Password", with: ""

    click_button "Log in"

    # expect(page).to have_content("You have not signed up successfully.")



  end
end
