require 'rails_helper'
RSpec.describe Auth::SessionsController, type: :controller do
describe 'GET #new' do
before do
request.env["devise.mapping"] = Devise.mappings[:user]
end
it 'returns http success' do
get :new
expect(response).to have_http_status(:success)
describe 'POST #create' do
let(:user) { Fabricate(:user, email: 'foo@bar.com', password: 'abcdefgh') }
post :create, params: { user: { email: user.email, password: user.password } }
it 'redirects to home' do
expect(response).to redirect_to(root_path)
it 'logs the user in' do
expect(controller.current_user).to eq user