diff options
Diffstat (limited to 'activejob/Rakefile')
-rw-r--r-- | activejob/Rakefile | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/activejob/Rakefile b/activejob/Rakefile index b2910de81d..e661622165 100644 --- a/activejob/Rakefile +++ b/activejob/Rakefile @@ -1,6 +1,7 @@ -require 'bundler/gem_tasks' - require 'rake/testtask' +require 'rubygems/package_task' + +dir = File.dirname(__FILE__) def run_without_aborting(*tasks) errors = [] @@ -18,51 +19,66 @@ end task default: :test -ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner) +ACTIVEJOB_ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner) desc 'Run all adapter tests' task :test do - tasks = ADAPTERS.map{|a| "test_#{a}" }+["integration_test"] + tasks = ACTIVEJOB_ADAPTERS.map{|a| "test_#{a}" } run_without_aborting(*tasks) end -ADAPTERS.each do |adapter| - Rake::TestTask.new("test_#{adapter}") do |t| - t.libs << 'test' - t.test_files = FileList['test/cases/**/*_test.rb'] - t.verbose = true +namespace :test do + desc 'Run all adapter tests in isolation' + task :isolated do + tasks = ACTIVEJOB_ADAPTERS.map{|a| "isolated_test_#{a}" } + run_without_aborting(*tasks) + end +end + + +ACTIVEJOB_ADAPTERS.each do |adapter| + namespace :test do + Rake::TestTask.new(adapter => "#{adapter}:env") do |t| + t.description = "" + t.libs << 'test' + t.test_files = FileList['test/cases/**/*_test.rb'] + t.verbose = true + end + + namespace :isolated do + task adapter => "#{adapter}:env" do + Dir.glob("#{dir}/test/cases/**/*_test.rb").all? do |file| + sh(Gem.ruby, '-w', "-I#{dir}/lib", "-I#{dir}/test", file) + end or raise 'Failures' + end + end end namespace adapter do task test: "test_#{adapter}" + task isolated_test: "isolated_test_#{adapter}" + task(:env) { ENV['AJADAPTER'] = adapter } end - task "test_#{adapter}" => "#{adapter}:env" -end - + desc "Run #{adapter} tests" + task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"] -desc 'Run all adapter integration tests' -task :integration_test do - tasks = (ADAPTERS-['inline']).map{|a| "integration_test_#{a}" } - run_without_aborting(*tasks) + desc "Run #{adapter} tests in isolation" + task "isolated_test_#{adapter}" => ["#{adapter}:env", "test:isolated:#{adapter}"] end -(ADAPTERS-['inline']).each do |adapter| - Rake::TestTask.new("integration_test_#{adapter}") do |t| - t.libs << 'test' - t.test_files = FileList['test/integration/**/*_test.rb'] - t.verbose = true - end - namespace "integration_#{adapter}" do - task test: "integration_test_#{adapter}" - task(:env) do - ENV['AJADAPTER'] = adapter - ENV['AJ_INTEGRATION_TESTS'] = "1" - end - end +spec = eval(File.read('activejob.gemspec')) + +Gem::PackageTask.new(spec) do |p| + p.gem_spec = spec +end - task "integration_test_#{adapter}" => "integration_#{adapter}:env" +desc 'Release to rubygems' +task release: :package do + require 'rake/gemcutter' + Rake::Gemcutter::Tasks.new(spec).define + Rake::Task['gem:push'].invoke end |