プロジェクト

全般

プロフィール

Vote #79958

完了

CalendarsControllerTest#test_show fails depending on the date

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
127
issue_org_id:
31131
author_id:
259873
assigned_to_id:
332
comments:
2
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

CalendarsControllerTest#test_show failed when running test on 2019/4/1.

Failure:
CalendarsControllerTest#test_show [test/functional/calendars_controller_test.rb:62]:
Expected at least 1 element matching "img[class="gravatar"]", found 0..
Expected 0 to be >= 1.

Steps to reproduce

When test data was created on 2019/4/1, issues_002 was not included in the April calendar.
CalendarsControllerTest#test_show failed because it was dependent on issues_002.

The following changes confirmed that the test was successful.


diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index 69e0053adc..624ae49f67 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -36,6 +36,9 @@ class CalendarsControllerTest < Redmine::ControllerTest
            :users, :email_addresses
 
   def test_show
+    # for gravatar test
+    Issue.generate!(:start_date => User.current.today, :assigned_to_id => 2)
+
     with_settings :gravatar_enabled => '1' do
       get :show, :params => {
           :project_id => 1


journals

The following code also fixes the problem. I think the code is a bit more efficient because it does not insert a record into the database.

<pre><code class="diff">
diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb
index 69e0053ad..2652d7f49 100644
--- a/test/functional/calendars_controller_test.rb
+++ b/test/functional/calendars_controller_test.rb
@@ -36,6 +36,10 @@ class CalendarsControllerTest < Redmine::ControllerTest
:users, :email_addresses

def test_show
+ # Ensure that an issue to which a user is assigned is in the current
+ # month's calendar in order to test Gravatar
+ travel_to issues(:issues_002).start_date
+
with_settings :gravatar_enabled => '1' do
get :show, :params => {
:project_id => 1

</code></pre>
--------------------------------------------------------------------------------
Committed the patch in #31131#note-1.

Mizuki, thank you for investigating and reporting this issue.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0