diff options
author | Abdelkader Boudih <terminale@gmail.com> | 2014-08-13 12:57:23 +0000 |
---|---|---|
committer | Abdelkader Boudih <terminale@gmail.com> | 2014-08-13 13:55:08 +0000 |
commit | 9b209603d07cad48b47d554407d6319c9fcced18 (patch) | |
tree | f124bd89c1c24eb01b67fbd817efca43bdb949d0 /activejob/test | |
parent | 67f8b6b2bc7e7eca8723996b1303c3fafa5ed39b (diff) | |
download | rails-9b209603d07cad48b47d554407d6319c9fcced18.tar.gz rails-9b209603d07cad48b47d554407d6319c9fcced18.tar.bz2 rails-9b209603d07cad48b47d554407d6319c9fcced18.zip |
Clean adapter_test.rb and skip test for sidekiq in unsupported rubies
Diffstat (limited to 'activejob/test')
-rw-r--r-- | activejob/test/cases/adapter_test.rb | 54 | ||||
-rw-r--r-- | activejob/test/helper.rb | 21 |
2 files changed, 22 insertions, 53 deletions
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' |