diff options
-rw-r--r-- | Gemfile | 22 | ||||
-rw-r--r-- | activejob/test/cases/adapter_test.rb | 54 | ||||
-rw-r--r-- | activejob/test/helper.rb | 21 |
3 files changed, 33 insertions, 64 deletions
@@ -36,17 +36,17 @@ end gem 'dalli', '>= 2.2.1' # ActiveJob -gem 'resque' -gem 'resque-scheduler' -gem 'sidekiq' -gem 'sucker_punch' -gem 'delayed_job' -gem 'queue_classic' -gem 'sneakers', '0.1.1.pre' -gem 'que' -gem 'backburner' -gem 'qu-rails', github: "bkeepers/qu", branch: "master" -gem 'qu-redis' +gem 'resque', require: false +gem 'resque-scheduler', require: false +gem 'sidekiq', require: false +gem 'sucker_punch', require: false +gem 'delayed_job', require: false +gem 'queue_classic', require: false +gem 'sneakers', '0.1.1.pre', require: false +gem 'que', require: false +gem 'backburner', require: false +gem 'qu-rails', github: "bkeepers/qu", branch: "master", require: false +gem 'qu-redis', require: false # Add your own local bundler stuff local_gemfile = File.dirname(__FILE__) + "/.Gemfile" diff --git a/activejob/test/cases/adapter_test.rb b/activejob/test/cases/adapter_test.rb index 7f6f4c1159..4fc235ae40 100644 --- a/activejob/test/cases/adapter_test.rb +++ b/activejob/test/cases/adapter_test.rb @@ -1,56 +1,8 @@ require 'helper' class AdapterTest < ActiveSupport::TestCase - setup { @old_adapter = ActiveJob::Base.queue_adapter } - teardown { ActiveJob::Base.queue_adapter = @old_adapter } - - test 'should load inline adapter' do - ActiveJob::Base.queue_adapter = :inline - assert_equal ActiveJob::QueueAdapters::InlineAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Delayed Job adapter' do - ActiveJob::Base.queue_adapter = :delayed_job - assert_equal ActiveJob::QueueAdapters::DelayedJobAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Qu adapter' do - ActiveJob::Base.queue_adapter = :qu - assert_equal ActiveJob::QueueAdapters::QuAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Que adapter' do - ActiveJob::Base.queue_adapter = :que - assert_equal ActiveJob::QueueAdapters::QueAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Queue Classic adapter' do - ActiveJob::Base.queue_adapter = :queue_classic - assert_equal ActiveJob::QueueAdapters::QueueClassicAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Resque adapter' do - ActiveJob::Base.queue_adapter = :resque - assert_equal ActiveJob::QueueAdapters::ResqueAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Sidekiq adapter' do - ActiveJob::Base.queue_adapter = :sidekiq - assert_equal ActiveJob::QueueAdapters::SidekiqAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Sucker Punch adapter' do - ActiveJob::Base.queue_adapter = :sucker_punch - assert_equal ActiveJob::QueueAdapters::SuckerPunchAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Sneakers adapter' do - ActiveJob::Base.queue_adapter = :sneakers - assert_equal ActiveJob::QueueAdapters::SneakersAdapter, ActiveJob::Base.queue_adapter - end - - test 'should load Backburner adapter' do - ActiveJob::Base.queue_adapter = :backburner - assert_equal ActiveJob::QueueAdapters::BackburnerAdapter, ActiveJob::Base.queue_adapter + test "should load #{ENV['AJADAPTER']} adapter" do + ActiveJob::Base.queue_adapter = ENV['AJADAPTER'].to_sym + assert_equal ActiveJob::Base.queue_adapter, "active_job/queue_adapters/#{ENV['AJADAPTER']}_adapter".classify.constantize end end diff --git a/activejob/test/helper.rb b/activejob/test/helper.rb index 8e255c1696..5e491332ee 100644 --- a/activejob/test/helper.rb +++ b/activejob/test/helper.rb @@ -2,9 +2,26 @@ require File.expand_path('../../../load_paths', __FILE__) require 'active_job' -adapter = ENV['AJADAPTER'] || 'inline' +@adapter = ENV['AJADAPTER'] || 'inline' -require "adapters/#{adapter}" +def sidekiq? + @adapter == 'sidekiq' +end + +def rubinius? + RUBY_ENGINE == 'rbx' +end + +def ruby_193? + RUBY_VERSION == '1.9.3' && RUBY_ENGINE != 'java' +end + +#Sidekiq don't work with MRI 1.9.3 +#Travis uses rbx 2.6 which don't support unicode characters in methods. +#Remove the check when Travis change to rbx 2.7+ +exit if sidekiq? && (ruby_193? || rubinius?) + +require "adapters/#{@adapter}" require 'active_support/testing/autorun' |