authorize_user(user_or_role = nil)click to toggle source
Used to stub the current_user in integration specs
Pass either a user object or a symbol in the format of ‘:as_admin’.
# File lib/alchemy/test_support/integration_helpers.rb, line 14defauthorize_user(user_or_role = nil)
user = caseuser_or_rolewhenSymbol, Stringbuild(:alchemy_dummy_user, user_or_role)
elseuser_or_roleendallow_any_instance_of(ApplicationController).toreceive(:current_user).and_return(user)
end