Rails has changed this behavior. It processes all test files in the same run to increase the speed. You can simulate the old behavior by running separate tasks with the following:
$ rake test:units test:controllers test:integration
سؤال
I'm switching one of my projects to rails 4.1, which by default uses minitest version 5.
I also use minitest-rails 2.0.1 gem.
Before switching to minitest 5, in rails 4.0 when I ran rake test, it used to run model tests first, then controllers, etc...
Now with minitest 5 doesn't seem like this is happening.
Is there a way to keep that current option?
المحلول
Rails has changed this behavior. It processes all test files in the same run to increase the speed. You can simulate the old behavior by running separate tasks with the following:
$ rake test:units test:controllers test:integration
نصائح أخرى
You can create your own rake tasks to run tests separately. Examples:
Rails 5
$ rails test:unit
$ rails test:system
lib/tasks/tests.rake
gem 'minitest'
require 'minitest'
require 'rails/test_unit/minitest_plugin'
namespace :test do
task :system => "test:prepare" do
$: << "test"
Minitest.rake_run(["test/system"])
end
task :unit => "test:prepare" do
$: << "test"
Minitest.rake_run(FileList['test/*'].exclude('test/system'))
end
end
Source: https://github.com/rails/rails/blob/master/railties/lib/rails/test_unit/testing.rake
Rails 4 you can check out here: https://github.com/rails/rails/blob/4-2-stable/railties/lib/rails/test_unit/testing.rake