Project

General

Profile

Actions

Defect #40205

closed

ThemesTest may fail if a third-party theme having theme.js is installed

Added by Go MAEDA 10 months ago. Updated 9 months ago.

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

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

ThemesTest fail if a third-party theme having theme.js is installed, and if the name of the theme is the last in alphabetical order among the installed themes.

Failure:
ThemesTest#test_with_sub_uri [test/integration/lib/redmine/themes_test.rb:100]:
Expected at least 1 element matching "script[src^=\"/foo/assets/themes/x-theme/theme.js\"]", found 0.
Expected 0 to be >= 1.

bin/rails test test/integration/lib/redmine/themes_test.rb:92

.F

Failure:
ThemesTest#test_with_theme_js [test/integration/lib/redmine/themes_test.rb:56]:
Expected exactly 1 element matching "script[src^=\"/assets/themes/x-theme/theme.js\"]", found 0.
Expected: 1
  Actual: 0

bin/rails test test/integration/lib/redmine/themes_test.rb:50

You can reproduce this error with the following procedure.

bin/rails test test/integration/lib/redmine/themes_test.rb
git clone https://github.com/farend/redmine_theme_farend_bleuclair.git public/themes/x-theme
bin/rails test test/integration/lib/redmine/themes_test.rb
Actions #1

Updated by Go MAEDA 10 months ago

I don't know if this is the right approach, but changing the code as follows will fix the issue.

diff --git a/test/integration/lib/redmine/themes_test.rb b/test/integration/lib/redmine/themes_test.rb
index d058df830..28055375b 100644
--- a/test/integration/lib/redmine/themes_test.rb
+++ b/test/integration/lib/redmine/themes_test.rb
@@ -23,7 +23,7 @@ class ThemesTest < Redmine::IntegrationTest

   def setup
     Redmine::Themes.rescan
-    @theme = Redmine::Themes.themes.last
+    @theme = Redmine::Themes.theme('alternate')
     Setting.ui_theme = @theme.id
   end

Actions #2

Updated by Marius BĂLTEANU 9 months ago

  • Category set to Code cleanup/refactoring
  • Status changed from New to Closed
  • Assignee set to Marius BĂLTEANU
  • Target version set to 6.0.0
  • Resolution set to Fixed

I had the same issue when I worked on #39111 and I've installed some custom themes. I've committed the fix proposed by you, but with a change: classic instead alternate because that is the last theme.

Actions

Also available in: Atom PDF