DEV: Default to `development` RAILS_ENV when running theme tests (#13106)

DEV: Default to development RAILS_ENV when running theme tests (#13106)

When testing theme components in development, it doesn’t make sense to use the test environment. The test environment almost certainly has 0 themes installed.

This change still works fine when using the themes:install_and_test rake task, because that rake task explicitly specifies environment/database-config.

diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 83c1038..f11a628 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -114,6 +114,7 @@ task "themes:qunit", :type, :value do |t, args|
     MSG
   end
   ENV["THEME_#{type.upcase}"] = value.to_s
+  ENV["QUNIT_RAILS_ENV"] ||= 'development' # qunit:test will switch to `test` by default
   Rake::Task["qunit:test"].reenable
   Rake::Task["qunit:test"].invoke(1200000, "/theme-qunit")
 end

GitHub sha: 93ae1b2b

1 Like

This commit appears in #13106 which was approved by riking and OsamaSayegh. It was merged by davidtaylorhq.