0

According to the Rails guide for testing:

"By default, running bin/rails test won't run your system tests. Make sure to run bin/rails test:system to actually run them."

Does anyone know how to change the default behavior so it will run all of your tests including system tests?

Tom Rossi
  • 11,604
  • 5
  • 65
  • 96

1 Answers1

0

I'm trying to do the same.

I think that for having rails test to also run system tests you need to redefine the rake task. For what I could investigate the task is defined at testing.rake file inside the railties gem /lib directory:

desc "Runs all tests in test folder except system ones"
  task :test do
  $: << "test"
  if ENV.key?("TEST")
    Minitest.rake_run([ENV["TEST"]])
  else
    Minitest.rake_run(["test"], ["test/system/**/*"])
  end
end

The second argument in the function inside else is a pattern to exclude when running the tests.

Here Overriding rails' default rake tasks it's explained how to override them, however I couldn't put it to work this way.

If it helps you, I'm using bundle exec rake test:system test instead and it runs both the system and all the other tests together

gasc
  • 638
  • 7
  • 14