Patch #31964

VersionsControllerTest#test_show randomly fails

Added by Yuichi HARADA 6 months ago. Updated 6 months ago.

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

0%

Category:Code cleanup/refactoring
Target version:-

Description

Failure:
VersionsControllerTest#test_show [test/functional/versions_controller_test.rb:125]:
Expected exactly 0 elements matching "img.gravatar", found 1..
Expected: 0
  Actual: 1

bin/rails test test/functional/versions_controller_test.rb:117

Solved by the following patch.

diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb
index 358b6f8c0..8981c6932 100644
--- a/test/functional/versions_controller_test.rb
+++ b/test/functional/versions_controller_test.rb
@@ -115,14 +115,16 @@ class VersionsControllerTest < Redmine::ControllerTest
   end

   def test_show
-    get :show, :params => {:id => 2}
-    assert_response :success
+    with_settings :gravatar_enabled => '0' do
+      get :show, :params => {:id => 2}
+      assert_response :success

-    assert_select 'h2', :text => /1.0/
-    assert_select 'span[class=?]', 'badge badge-status-locked', :text => 'locked'
+      assert_select 'h2', :text => /1.0/
+      assert_select 'span[class=?]', 'badge badge-status-locked', :text => 'locked'

-    # no issue avatar when gravatar is disabled
-    assert_select 'img.gravatar', :count => 0
+      # no issue avatar when gravatar is disabled
+      assert_select 'img.gravatar', :count => 0
+    end
   end

   def test_show_should_show_issue_assignee


Related issues

Related to Redmine - Patch #28510: Show issue assignee gravatar in roadmap and version page Closed

Associated revisions

Revision 18406
Added by Go MAEDA 6 months ago

VersionsControllerTest#test_show randomly fails (#31964, #28510).

Patch by Yuichi HARADA.

History

#1 Updated by Go MAEDA 6 months ago

Thank you for reporting this issue. Could you tell me the run option of bin/rails test to reproduce the error?

#2 Updated by Yuichi HARADA 6 months ago

Go MAEDA wrote:

Thank you for reporting this issue. Could you tell me the run option of bin/rails test to reproduce the error?

Sorry for the lack of explanation.
You can reproduce it with the following command:

$ RAILS_ENV=test bundle exec rake test TESTOPTS="--seed 41050" 

#3 Updated by Go MAEDA 6 months ago

  • Related to Patch #28510: Show issue assignee gravatar in roadmap and version page added

#4 Updated by Go MAEDA 6 months ago

Although I could not reproduce the error even with "--seed 41050" option, I understand that we have to set gravatar_enabled to 0 in the test.

#5 Updated by Go MAEDA 6 months ago

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

Committed the fix as a part of #28510. Thanks.

#6 Updated by Go MAEDA 6 months ago

  • Subject changed from VersionsControllerTest#test_show failed to VersionsControllerTest#test_show randomly fails

Also available in: Atom PDF