Actions
Defect #36336
closedExecuting test helper "log_user" function behavior is different between Redmine 4.0 and >= 4.1
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Accounts / authentication
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Wont fix
Affected version:
Description
I noticed that test helper "log_user" function behavior (User.current
value) is different between Redmine 4.0 and >= 4.1.
I am not sure whether this is unexpected result or expected result (or I just miss something)...
Redmine 4.0 (4.0-stable branch):¶
Edit test code:
--- a/test/integration/account_test.rb
+++ b/test/integration/account_test.rb
@@ -25,6 +25,7 @@ class AccountTest < Redmine::IntegrationTest
assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fmy%2Fpage"
log_user('jsmith', 'jsmith')
+ puts "User.current: #{User.current}"
get "/my/account"
assert_response :success
end
Execute test:
bundle exec rails test test/integration/account_test.rb:23
Run options: --seed 47668
# Running:
User.current: John Smith
.
Finished in 1.700418s, 0.5881 runs/s, 3.5285 assertions/s.
1 runs, 6 assertions, 0 failures, 0 errors, 0 skips
Redmine 4.1 and 4.2 (4.1-stable and 4.2-stable branches)¶
Edit test code:
--- a/test/integration/account_test.rb
+++ b/test/integration/account_test.rb
@@ -27,6 +27,7 @@ class AccountTest < Redmine::IntegrationTest
assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fmy%2Fpage"
log_user('jsmith', 'jsmith')
+ puts "User.current: #{User.current}"
get "/my/account"
assert_response :success
end
Execute test:
bundle exec rails test test/integration/account_test.rb:25
Run options: --seed 25932
# Running:
User.current: Anonymous
.
Finished in 1.583653s, 0.6315 runs/s, 3.7887 assertions/s.
1 runs, 6 assertions, 0 failures, 0 errors, 0 skips
Related issues
Updated by Go MAEDA almost 3 years ago
- Related to Feature #31911: Update request_store gem to 1.4 added
Updated by Go MAEDA almost 3 years ago
I think the behavior has changed by #31911 and you should use User.find(session[:user_id])
instead of User.current
in tests. See #31911#note-2, #16685#note-13, and #16685#note-13 for details.
Updated by Ko Nagase almost 3 years ago
- Status changed from New to Resolved
Okay, I see.
I set the status to "Resolved".
Thanks for the clarification!
Updated by Go MAEDA almost 3 years ago
- Status changed from Resolved to Closed
- Resolution set to Wont fix
Thank you for your feedback. Closing.
Actions