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
-
#sign_in ⇒ Object
Sets current_user on the view under test to a new instance of your user model.
-
#sign_in_as(user) ⇒ Object
Sets current_user on the view under test to the supplied user.
Instance Method Details
#sign_in ⇒ Object
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 sign_in 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 sign_in_as(user) view.current_user = user end |