The `app:test` engine task runs in development environment

When invoking the app:test task in an engine, the Rails environment is set to “development”. Is this the intended behaviour? It would be great if someone could shed some light on this, as it seems a bit confusing.

I can force the environment to “test” by prefixing the command with RAILS_ENV=test, but should that be necessary?

Steps to reproduce

  1. Generate a new Rails engine: rails plugin new blorgh --mountable
  2. Add the line puts Rails.env to test_helper.rb
  3. Run the task rails test. It will output test.
  4. Run the taks rails app:test. It will output development.

System configuration

  • Rails version:
  • Ruby version: 2.6.4p104