Skip to content

Commit

Permalink
Unify test:isolated across components and run by default at toplevel
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Nov 11, 2009
1 parent e02bff2 commit bbb3e5a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Dir["#{File.dirname(__FILE__)}/*/lib/*/version.rb"].each do |version_path|
end

desc 'Run all tests by default'
task :default => :test
task :default => %w(test test:isolated)

%w(test isolated_test rdoc pgem package release gem gemspec).each do |task_name|
%w(test test:isolated rdoc pgem package release gem gemspec).each do |task_name|
desc "Run #{task_name} task for all projects"
task task_name do
errors = []
Expand Down
12 changes: 7 additions & 5 deletions actionmailer/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ Rake::TestTask.new { |t|
t.warning = true
}

task :isolated_test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/*_test.rb").all? do |file|
system(ruby, '-Ilib:test', file)
end or raise "Failures"
namespace :test do
task :isolated do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/*_test.rb").all? do |file|
system(ruby, '-Ilib:test', file)
end or raise "Failures"
end
end

# Generate the RDoc documentation
Expand Down
12 changes: 7 additions & 5 deletions activemodel/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ Rake::TestTask.new do |t|
t.warning = true
end

task :isolated_test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("#{dir}/test/**/*_test.rb").all? do |file|
system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file)
end or raise "Failures"
namespace :test do
task :isolated do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("#{dir}/test/**/*_test.rb").all? do |file|
system(ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file)
end or raise "Failures"
end
end


Expand Down
12 changes: 7 additions & 5 deletions activerecord/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ task :test do
run_without_aborting(*tasks)
end

task :isolated_test do
tasks = defined?(JRUBY_VERSION) ?
%w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) :
%w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql)
run_without_aborting(*tasks)
namespace :test do
task :isolated do
tasks = defined?(JRUBY_VERSION) ?
%w(isolated_test_jdbcmysql isolated_test_jdbcsqlite3 isolated_test_jdbcpostgresql) :
%w(isolated_test_mysql isolated_test_sqlite3 isolated_test_postgresql)
run_without_aborting(*tasks)
end
end

%w( mysql postgresql sqlite3 firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
Expand Down
15 changes: 8 additions & 7 deletions activeresource/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ Rake::TestTask.new { |t|
t.warning = true
}

task :isolated_test do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib"
Dir.glob("test/**/*_test.rb").all? do |file|
system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file)
end or raise "Failures"
namespace :test do
task :isolated do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib"
Dir.glob("test/**/*_test.rb").all? do |file|
system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file)
end or raise "Failures"
end
end


# Generate the RDoc documentation

Rake::RDocTask.new { |rdoc|
Expand Down
20 changes: 11 additions & 9 deletions railties/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@ RUBY_FORGE_USER = "webster132"


task :default => :test
task :test => 'test:isolated'

## This is required until the regular test task
## below passes. It's not ideal, but at least
## we can see the failures
task :test do
dir = ENV["TEST_DIR"] || "**"
Dir["test/#{dir}/*_test.rb"].all? do |file|
next true if file.include?("fixtures")
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file)
end or raise "Failures"
namespace :test do
task :isolated do
dir = ENV["TEST_DIR"] || "**"
Dir["test/#{dir}/*_test.rb"].all? do |file|
next true if file.include?("fixtures")
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file)
end or raise "Failures"
end
end
task :isolated_test => :test

Rake::TestTask.new("regular_test") do |t|
Rake::TestTask.new('test:regular') do |t|
t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib"
t.pattern = 'test/**/*_test.rb'
t.warning = true
Expand Down

0 comments on commit bbb3e5a

Please sign in to comment.