module ControllerHelper
Public Instance Methods
not_signed_in()
click to toggle source
# File lib/spec_snap/controller_helper.rb, line 14 def not_signed_in allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user}) allow(controller).to receive(:current_user).and_return(nil) end
sign_in(user)
click to toggle source
# File lib/spec_snap/controller_helper.rb, line 5 def sign_in(user) if user.nil? not_signed_in else allow(request.env['warden']).to receive(:authenticate!).and_return(user) allow(controller).to receive(:current_user).and_return(user) end end