Project

General

Profile

Actions

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.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
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 timezone setClosedJean-Philippe Lang

Actions
Actions #1

Updated by Mizuki ISHIKAWA over 5 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

Actions #2

Updated by Go MAEDA over 5 years ago

The failure is caused by r18264.

Actions #3

Updated by Go MAEDA over 5 years ago

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

Updated by Go MAEDA over 5 years ago

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

Committed the fix. Thanks.

Actions

Also available in: Atom PDF