Module: ControllerHelpers
- Defined in:
- lib/generators/turbolog/templates/spec/support/controller_helper.rb
Overview
Instance Method Summary collapse
Instance Method Details
#sign_in(user = double('user')) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/generators/turbolog/templates/spec/support/controller_helper.rb', line 3 def sign_in(user = double('user')) if user.nil? allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user}) allow(controller).to receive(:current_user).and_return(nil) else allow(request.env['warden']).to receive(:authenticate!).and_return(user) allow(controller).to receive(:current_user).and_return(user) end end |