Add your own test tasks as dependencies on the `test:run` task instead of `test` itself.
namespace :test do
task run: 'test:acceptance'
Rails::SubTestTask.new acceptance: 'test:prepare' do |t|
t.libs << 'test'
t.pattern = 'test/acceptance/**/*_test.rb'
end
end
This makes it easier to add your own tests to the default suite:
task test: 'test:acceptance'
namespace :test do
Rails::SubTestTask.new acceptance: 'test:prepare' do |t|
t.libs << 'test'
t.pattern = 'test/acceptance/**/*_test.rb'
end
end
Now `rake` runs unit, functional, integration, and acceptance tests.
I found this bug when running rake test:uncommitted
on a newly generated rails app which don't have
test file for application_controller.
Can see detail here #3461
With config.generators becomes a way to configure generators
for current instance only. For example:
module Blog
class Engine < Rails::Engine
config.generators do |g|
g.orm :active_record
end
config.app_generators do |g|
g.test_framework :rspec
end
end
end
such definition sets :active_record as orm for engine and :rspec
as test_framework for application. The values set with app_generators
can be overwritten in application using config.generators as you would
normally do:
module MyApp
class Application < Rails::Application
config.generators do |g|
g.test_framework :test_unit
end
end
end