Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting current_user in integration helper #2006

Merged
merged 1 commit into from
Jan 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/alchemy/test_support/integration_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ module TestSupport
# This file is included in spec_helper.rb
#
module IntegrationHelpers
# Used to stub the current_alchemy_user
# Used to stub the current_user in integration specs
#
# Pass either a user object or a symbol in the format of ':as_admin'.
# The browser language is set to english ('en')
#
def authorize_user(user_or_role = nil)
if user_or_role.is_a?(Alchemy.user_class)
user = user_or_role
else
case user_or_role
when Symbol, String
user = build(:alchemy_dummy_user, user_or_role)
else
user = user_or_role
end
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
end
Expand Down