2017-07-09 13:49:52 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:40:03 -04:00
|
|
|
|
2016-08-06 12:41:18 -04:00
|
|
|
require "helper"
|
|
|
|
require "jobs/hello_job"
|
|
|
|
require "jobs/logging_job"
|
|
|
|
require "jobs/nested_job"
|
2014-08-29 16:11:17 -04:00
|
|
|
|
|
|
|
class ActiveJobTestCaseTest < ActiveJob::TestCase
|
2014-09-23 23:43:12 -04:00
|
|
|
# this tests that this job class doesn't get its adapter set.
|
2015-05-25 09:26:15 -04:00
|
|
|
# that's the correct behavior since we don't want to break
|
|
|
|
# the `class_attribute` inheritance
|
|
|
|
class TestClassAttributeInheritanceJob < ActiveJob::Base
|
2014-09-23 23:43:12 -04:00
|
|
|
def self.queue_adapter=(*)
|
2016-08-06 12:41:18 -04:00
|
|
|
raise "Attempting to break `class_attribute` inheritance, bad!"
|
2014-09-23 23:43:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-29 16:11:17 -04:00
|
|
|
def test_include_helper
|
|
|
|
assert_includes self.class.ancestors, ActiveJob::TestHelper
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_set_test_adapter
|
2016-08-07 19:05:28 -04:00
|
|
|
assert_kind_of ActiveJob::QueueAdapters::TestAdapter, queue_adapter
|
2014-08-29 16:11:17 -04:00
|
|
|
end
|
|
|
|
end
|