Move improved isolated test runner to AP
This commit is contained in:
parent
018b79dd36
commit
75a2f00c97
|
@ -34,22 +34,21 @@ end
|
||||||
desc "Run all unit tests"
|
desc "Run all unit tests"
|
||||||
task :test => [:test_action_pack, :test_active_record_integration]
|
task :test => [:test_action_pack, :test_active_record_integration]
|
||||||
|
|
||||||
TESTS_GLOB = "test/{abstract,controller,dispatch,template}/**/*_test.rb"
|
|
||||||
|
|
||||||
Rake::TestTask.new(:test_action_pack) do |t|
|
Rake::TestTask.new(:test_action_pack) do |t|
|
||||||
t.libs << 'test'
|
t.libs << 'test'
|
||||||
|
|
||||||
# make sure we include the tests in alphabetical order as on some systems
|
# make sure we include the tests in alphabetical order as on some systems
|
||||||
# this will not happen automatically and the tests (as a whole) will error
|
# this will not happen automatically and the tests (as a whole) will error
|
||||||
t.test_files = Dir.glob(TESTS_GLOB).sort
|
t.test_files = Dir.glob('test/{abstract,controller,dispatch,template}/**/*_test.rb').sort
|
||||||
|
|
||||||
t.verbose = true
|
t.verbose = true
|
||||||
# t.warning = true
|
# t.warning = true
|
||||||
end
|
end
|
||||||
|
|
||||||
task :isolated_test do
|
namespace :test do
|
||||||
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
Rake::TestTask.new(:isolated) do |t|
|
||||||
Dir.glob(TESTS_GLOB).all? { |file| system(ruby, '-Ilib:test', file) } or raise "Failures"
|
t.pattern = 'test/ts_isolated.rb'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'ActiveRecord Integration Tests'
|
desc 'ActiveRecord Integration Tests'
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
require 'test/unit'
|
||||||
|
require 'rbconfig'
|
||||||
|
require 'rubygems'
|
||||||
|
require 'active_support'
|
||||||
|
|
||||||
|
class TestIsolated < Test::Unit::TestCase
|
||||||
|
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
||||||
|
|
||||||
|
Dir["#{File.dirname(__FILE__)}/{abstract,controller,dispatch,template}/**/*_test.rb"].each do |file|
|
||||||
|
define_method("test #{file}") do
|
||||||
|
command = "#{ruby} -Ilib:test #{file}"
|
||||||
|
silence_stderr { `#{command}` }
|
||||||
|
assert_equal 0, $?.to_i, command
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue