mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #10781 from arunagw/run-isolated-test
Running isolated tests
This commit is contained in:
commit
e1b59a268b
4 changed files with 13 additions and 37 deletions
|
@ -22,11 +22,15 @@ Rake::TestTask.new(:test_action_pack) do |t|
|
|||
end
|
||||
|
||||
namespace :test do
|
||||
Rake::TestTask.new(:isolated) do |t|
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/ts_isolated.rb'
|
||||
task :isolated do
|
||||
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
||||
Dir.glob("test/{abstract,controller,dispatch,template}/**/*_test.rb").all? do |file|
|
||||
sh(ruby, '-Ilib:test', file)
|
||||
end or raise "Failures"
|
||||
end
|
||||
end
|
||||
|
||||
namespace :test do
|
||||
Rake::TestTask.new(:template) do |t|
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/template/**/*.rb'
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
require 'active_support/testing/autorun'
|
||||
require 'rbconfig'
|
||||
require 'abstract_unit'
|
||||
|
||||
class TestIsolated < ActiveSupport::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}"
|
||||
result = silence_stderr { `#{command}` }
|
||||
assert $?.to_i.zero?, "#{command}\n#{result}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -9,13 +9,16 @@ Rake::TestTask.new do |t|
|
|||
t.verbose = true
|
||||
end
|
||||
|
||||
|
||||
namespace :test do
|
||||
Rake::TestTask.new(:isolated) do |t|
|
||||
t.pattern = 'test/ts_isolated.rb'
|
||||
task :isolated do
|
||||
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
||||
Dir.glob("test/**/*_test.rb").all? do |file|
|
||||
sh(ruby, '-Ilib:test', file)
|
||||
end or raise "Failures"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
spec = eval(File.read('activesupport.gemspec'))
|
||||
|
||||
Gem::PackageTask.new(spec) do |p|
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
require 'active_support/testing/autorun'
|
||||
require 'active_support/test_case'
|
||||
require 'rbconfig'
|
||||
require 'active_support/core_ext/kernel/reporting'
|
||||
|
||||
class TestIsolated < ActiveSupport::TestCase
|
||||
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
||||
|
||||
Dir["#{File.dirname(__FILE__)}/**/*_test.rb"].each do |file|
|
||||
define_method("test #{file}") do
|
||||
command = "#{ruby} -Ilib:test #{file}"
|
||||
result = silence_stderr { `#{command}` }
|
||||
assert $?.to_i.zero?, "#{command}\n#{result}"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue