require 'rails_helper'

RSpec.feature "Signing out a user" do
  before do
    @user = User.create!({email:"example@example.com", password:"123456", password_confirmation:"123456"})

    visit '/'

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

    click_button "Log in"
  end
  scenario "A user signs out" do
    visit '/'

    click_link 'Sign Out'

    expect(page).to have_content("Signed out successfully.")
    expect(page).not_to have_link("Sign Out")
  end
end
