diff options
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/sub_test_task.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 20 |
2 files changed, 9 insertions, 15 deletions
diff --git a/railties/lib/rails/test_unit/sub_test_task.rb b/railties/lib/rails/test_unit/sub_test_task.rb index d9bffba4d7..6fa96d2ced 100644 --- a/railties/lib/rails/test_unit/sub_test_task.rb +++ b/railties/lib/rails/test_unit/sub_test_task.rb @@ -7,7 +7,7 @@ module Rails # # This class takes a TestInfo class and defines the appropriate rake task # based on the information, then invokes it. - class TestCreator + class TestCreator # :nodoc: def initialize(info) @info = info end @@ -41,7 +41,7 @@ module Rails # to test files (or can be transformed into test files). Calling <tt>files</tt> # provides the set of test files and is used when initializing tests after # a call to <tt>rake test</tt>. - class TestInfo + class TestInfo # :nodoc: def initialize(tasks) @tasks = tasks @files = nil diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 547846c833..d836c0d6d6 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -1,35 +1,29 @@ -require 'rbconfig' require 'rake/testtask' require 'rails/test_unit/sub_test_task' task default: :test -desc 'Runs test:units, test:functionals, test:integration together' +desc "Runs all tests in test folder" task :test do Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task end namespace :test do task :prepare do - # Placeholder task for other Railtie and plugins to enhance. See Active Record for an example. + # Placeholder task for other Railtie and plugins to enhance. + # If used with Active Record, this task runs before the database schema is synchronized. end - task :run => ['test:units', 'test:functionals', 'test:generators', 'test:integration'] - - # Inspired by: http://ngauthier.com/2012/02/quick-tests-with-bash.html - desc "Run tests quickly by merging all types and not resetting db" - Rails::TestTask.new(:all) do |t| + Rails::TestTask.new(:run) do |t| t.pattern = "test/**/*_test.rb" end - namespace :all do - desc "Run tests quickly, but also reset db" - task :db => %w[db:test:prepare test:all] - end + desc "Run tests quickly, but also reset db" + task :db => %w[db:test:prepare test] Rails::TestTask.new(single: "test:prepare") - ["models", "helpers", "controllers", "mailers", "integration"].each do |name| + ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name| Rails::TestTask.new(name => "test:prepare") do |t| t.pattern = "test/#{name}/**/*_test.rb" end |