diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/test_unit/minitest_plugin.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/test_requirer.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 10 |
3 files changed, 16 insertions, 7 deletions
diff --git a/railties/lib/rails/test_unit/minitest_plugin.rb b/railties/lib/rails/test_unit/minitest_plugin.rb index 8e5301d1e0..dacab08ec3 100644 --- a/railties/lib/rails/test_unit/minitest_plugin.rb +++ b/railties/lib/rails/test_unit/minitest_plugin.rb @@ -29,12 +29,21 @@ module Minitest options[:patterns] = opts.order! end + # Running several Rake tasks in a single command would trip up the runner, + # as the patterns would also contain the other Rake tasks. + def self.rake_run(patterns) # :nodoc: + @rake_patterns = patterns + run + end + def self.plugin_rails_init(options) self.run_with_rails_extension = true ENV["RAILS_ENV"] = options[:environment] || "test" - ::Rails::TestRequirer.require_files options[:patterns] unless run_with_autorun + unless run_with_autorun + ::Rails::TestRequirer.require_files @rake_patterns || options[:patterns] + end unless options[:full_backtrace] || ENV["BACKTRACE"] # Plugin can run without Rails loaded, check before filtering. diff --git a/railties/lib/rails/test_unit/test_requirer.rb b/railties/lib/rails/test_unit/test_requirer.rb index 84c2256729..83d2c55ffd 100644 --- a/railties/lib/rails/test_unit/test_requirer.rb +++ b/railties/lib/rails/test_unit/test_requirer.rb @@ -18,7 +18,7 @@ module Rails arg = arg.gsub(/:(\d+)?$/, '') if Dir.exist?(arg) "#{arg}/**/*_test.rb" - elsif File.file?(arg) + else arg end end diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index dda492f974..6676c6a079 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -7,7 +7,7 @@ task default: :test desc "Runs all tests in test folder" task :test do $: << "test" - Minitest.run(['test']) + Minitest.rake_run(["test"]) end namespace :test do @@ -24,22 +24,22 @@ namespace :test do ["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name| task name => "test:prepare" do $: << "test" - Minitest.run(["test/#{name}"]) + Minitest.rake_run(["test/#{name}"]) end end task :generators => "test:prepare" do $: << "test" - Minitest.run(["test/lib/generators"]) + Minitest.rake_run(["test/lib/generators"]) end task :units => "test:prepare" do $: << "test" - Minitest.run(["test/models", "test/helpers", "test/unit"]) + Minitest.rake_run(["test/models", "test/helpers", "test/unit"]) end task :functionals => "test:prepare" do $: << "test" - Minitest.run(["test/controllers", "test/mailers", "test/functional"]) + Minitest.rake_run(["test/controllers", "test/mailers", "test/functional"]) end end |