DEV: Default to `development` RAILS_ENV when running theme tests (PR #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.

GitHub

but then it breaks rake themes:qunit when running in production?

I am not sure what the right thing is to do here, lets wait on @OsamaSayegh, he can decide next week when he gets started.

but then it breaks rake themes:qunit when running in production?

Is that supposed to work? IIRC the thing that’s used in production is themes:install_and_test, which uses a temporary DB, and is not affected by this PR.

lets wait on @OsamaSayegh, he can decide next week when he gets started

:+1: sounds good to me. No rush on this

Neither themes:qunit nor themes:install_and_test actually work in production because when in production the /theme-qunit route is restricted to admins and AFAIK our test script doesn’t login before running the tests:

The themes:install_and_test task sets the Rails env to development as well:

and to make it work inside production docker image during bootstrap I had to install our development and test gems as well as Chrome and Yarn which are needed to run qunit tests and then invoke the rake task.