You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure bin/rails test command defaults to test` env
`bin/rails test` was defauling to the `development` environment because
`ENV['RAILS_ENV']` and `ENV['RACK_ENV']` are nil and `default_rails_env`
defaults to the `development` environment when an environment is not
provided.
This resulted in Spring ignoring even explicitly setting the environment
option when running tests. The environment would get overwritten with
`development` even when `test` was set. Tests seemed to run fine, but if
there was a required file or included module the test would not be able
to find those files because the environment was set incorrectly.
Borrowing code from `RailsConsole` I updated `RailsTest` to set the
default env to `test` but take `--environment` and `-e` into account
like the other commands.
I added tests to ensure that when not set the environment will default
to `test`.
0 commit comments