diff options
Diffstat (limited to 'activejob/test/cases')
-rw-r--r-- | activejob/test/cases/adapter_test.rb | 2 | ||||
-rw-r--r-- | activejob/test/cases/queue_adapter_test.rb | 24 | ||||
-rw-r--r-- | activejob/test/cases/test_case_test.rb | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/activejob/test/cases/adapter_test.rb b/activejob/test/cases/adapter_test.rb index f0c710f9ed..6d75ae9a7c 100644 --- a/activejob/test/cases/adapter_test.rb +++ b/activejob/test/cases/adapter_test.rb @@ -2,6 +2,6 @@ require 'helper' class AdapterTest < ActiveSupport::TestCase test "should load #{ENV['AJ_ADAPTER']} adapter" do - assert_equal "active_job/queue_adapters/#{ENV['AJ_ADAPTER']}_adapter".classify, ActiveJob::Base.queue_adapter.name + assert_equal "active_job/queue_adapters/#{ENV['AJ_ADAPTER']}_adapter".classify, ActiveJob::Base.queue_adapter.class.name end end diff --git a/activejob/test/cases/queue_adapter_test.rb b/activejob/test/cases/queue_adapter_test.rb new file mode 100644 index 0000000000..d801a0852c --- /dev/null +++ b/activejob/test/cases/queue_adapter_test.rb @@ -0,0 +1,24 @@ +require 'helper' + +class QueueAdapterTest < ActiveJob::TestCase + test 'should forbid nonsense arguments' do + assert_raises(ArgumentError) { ActiveJob::Base.queue_adapter = Mutex } + assert_raises(ArgumentError) { ActiveJob::Base.queue_adapter = Mutex.new } + end + + test 'should warn on passing an adapter class' do + klass = Class.new do + def self.name + 'fake' + end + + def enqueue(*) + end + + def enqueue_at(*) + end + end + + assert_deprecated { ActiveJob::Base.queue_adapter = klass } + end +end diff --git a/activejob/test/cases/test_case_test.rb b/activejob/test/cases/test_case_test.rb index 7d1702990e..bd23878b23 100644 --- a/activejob/test/cases/test_case_test.rb +++ b/activejob/test/cases/test_case_test.rb @@ -9,6 +9,6 @@ class ActiveJobTestCaseTest < ActiveJob::TestCase end def test_set_test_adapter - assert_equal ActiveJob::QueueAdapters::TestAdapter, self.queue_adapter + assert_kind_of ActiveJob::QueueAdapters::TestAdapter, self.queue_adapter end end |