Module: Alchemy::TestSupport::IntegrationHelpers
- Defined in:
- lib/alchemy/test_support/integration_helpers.rb
Overview
Helpers for integration specs
This file is included in spec_helper.rb
Instance Method Summary collapse
-
#authorize_user(user_or_role = nil) ⇒ Object
Used to stub the current_alchemy_user.
Instance Method Details
#authorize_user(user_or_role = nil) ⇒ Object
Used to stub the current_alchemy_user
Pass either a user object or a symbol in the format of ‘:as_admin’. The browser language is set to english (‘en’)
14 15 16 17 18 19 20 21 |
# File 'lib/alchemy/test_support/integration_helpers.rb', line 14 def (user_or_role = nil) if user_or_role.is_a?(Alchemy.user_class) user = user_or_role else user = build(:alchemy_dummy_user, user_or_role) end allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) end |