Module: Clearance::Testing::ViewHelpers

Defined in:
lib/clearance/testing/view_helpers.rb

Overview

Provides helpers to your view and helper specs. Using these helpers makes current_user, signed_in? and signed_out? behave properly in view and helper specs.

Instance Method Summary collapse

Instance Method Details

#sign_inObject

Sets current_user on the view under test to a new instance of your user model.



9
10
11
# File 'lib/clearance/testing/view_helpers.rb', line 9

def 
  view.current_user = Clearance.configuration.user_model.new
end

#sign_in_as(user) ⇒ Object

Sets current_user on the view under test to the supplied user.



14
15
16
# File 'lib/clearance/testing/view_helpers.rb', line 14

def (user)
  view.current_user = user
end