Defect #31620

ActivitiesControllerTest#test_previous_project_index fails depending on the current time and zone

Added by Go MAEDA over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:-
Resolution:Fixed Affected version:

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

Related issues

Related to Redmine - Defect #30288: Groups are incorrect when grouping by date without user t... Closed

Associated revisions

Revision 18316
Added by Go MAEDA over 2 years ago

test_previous_project_index fails depending on the current time and zone (#30288, #31620).

Patch by Mizuki ISHIKAWA.

History

#1 Updated by Mizuki ISHIKAWA over 2 years ago

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

#2 Updated by Go MAEDA over 2 years ago

The failure is caused by r18264.

#3 Updated by Go MAEDA over 2 years ago

  • Related to Defect #30288: Groups are incorrect when grouping by date without user timezone set added

#4 Updated by Go MAEDA over 2 years ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thanks.

Also available in: Atom PDF