In Intermediate Rails Workshop we are using Monban gem to authentication. I’d like to write rspec test for DashboardsController to test method show:
class DashboardsController < ApplicationController
def show
@shout = Shout.new
@shouts = current_user.shouts
end
end
and my test
require ‘spec_helper’
describe DashboardsController do
describe 'GET #show' do
it 'assigns new shout instance to shout variable' do
user = create(:user)
sign_in(user)
get :show
expect(assigns(:shout)).to be_a_new(Shout)
end
it 'assigns all shouts of sign_in user to shouts variable' do
user = create(:user)
sign_in(user)
get :show
expect(assigns(:shouts)).to eq user.shouts
end
end
end
It obviously doesn’t work because sign_in method is undefined. So how can I log in user in rspec test with Monban?