aboutsummaryrefslogblamecommitdiffstats
path: root/railties/lib/rails/test_unit/testing.rake
blob: 0f26621b59e1705b8ff4706ca1800446a15622af (plain) (tree)
1
2
3
4
5
6
7
8
9
                                
 
                   
 
                                    
             
              

                                             
   
 
                  
                  

                                                                                            

     
                       


                                             
 
                                                                                       


                                             
       

     


                                                  

     


                                                                       

     


                                                                                  
     
   
require "rails/test_unit/runner"

task default: :test

desc "Runs all tests in test folder"
task :test do
  $: << "test"
  args = ARGV[0] == "test" ? ARGV[1..-1] : []
  Rails::TestRunner.run(args)
end

namespace :test do
  task :prepare do
    # 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 => %w[test]

  desc "Run tests quickly, but also reset db"
  task :db => %w[db:test:prepare test]

  ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
    task name => "test:prepare" do
      $: << "test"
      Rails::TestRunner.run(["test/#{name}"])
    end
  end

  task :generators => "test:prepare" do
    $: << "test"
    Rails::TestRunner.run(["test/lib/generators"])
  end

  task :units => "test:prepare" do
    $: << "test"
    Rails::TestRunner.run(["test/models", "test/helpers", "test/unit"])
  end

  task :functionals => "test:prepare" do
    $: << "test"
    Rails::TestRunner.run(["test/controllers", "test/mailers", "test/functional"])
  end
end