Actions
Patch #31131
closedCalendarsControllerTest#test_show fails depending on the date
Description
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.
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
Updated by Go MAEDA over 5 years ago
- Target version set to 4.1.0
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.
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
Updated by Go MAEDA over 5 years ago
- Subject changed from Fix CalendarsControllerTest#test_show failing at a specific timing to CalendarsControllerTest#test_show fails depending on the date
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch in #31131#note-1.
Mizuki, thank you for investigating and reporting this issue.
Actions