Defect #31620
closed
ActivitiesControllerTest#test_previous_project_index fails depending on the current time and zone
Added by Go MAEDA over 5 years ago.
Updated over 5 years ago.
Category:
Code cleanup/refactoring
Description
$ date -R ; bin/rails test test/functional/activities_controller_test.rb:52
Mon, 24 Jun 2019 17:23:48 -0700
Run options: --seed 40286
# Running:
F
Failure:
ActivitiesControllerTest#test_previous_project_index [/Users/maeda/redmines/trunk/test/functional/activities_controller_test.rb:59]:
<(?-mix:22)> expected but was
<Project>..
Expected 0 to be >= 1.
bin/rails test test/functional/activities_controller_test.rb:52
The test should succeed if you change it as below.
diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb
index c94a9c9392..5b0cf9d022 100644
--- a/test/functional/activities_controller_test.rb
+++ b/test/functional/activities_controller_test.rb
@@ -50,13 +50,14 @@ class ActivitiesControllerTest < Redmine::ControllerTest
end
def test_previous_project_index
+ @request.session[:user_id] = 1
get :index, :params => {
:id => 1,
:from => 2.days.ago.to_date
}
assert_response :success
- assert_select 'h3', :text => /#{3.days.ago.to_date.day}/
+ assert_select 'h3', :text => /#{User.current.time_to_date(3.days.ago).day}/
assert_select 'dl dt.issue a', :text => /Cannot print recipes/
end
The failure is caused by r18264.
- Related to Defect #30288: Groups are incorrect when grouping by date without user timezone set added
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix. Thanks.
Also available in: Atom
PDF