2014-05-18 10:24:30 -04:00
|
|
|
require 'helper'
|
|
|
|
require 'jobs/hello_job'
|
2014-08-12 06:53:46 -04:00
|
|
|
require 'jobs/logging_job'
|
|
|
|
require 'jobs/nested_job'
|
2014-05-18 10:24:30 -04:00
|
|
|
|
|
|
|
class QueueNamingTest < ActiveSupport::TestCase
|
|
|
|
test 'name derived from base' do
|
|
|
|
assert_equal "active_jobs", HelloJob.queue_name
|
|
|
|
end
|
2014-08-12 06:53:46 -04:00
|
|
|
|
2014-05-18 10:24:30 -04:00
|
|
|
test 'name appended in job' do
|
|
|
|
begin
|
|
|
|
HelloJob.queue_as :greetings
|
2014-06-09 12:49:14 -04:00
|
|
|
LoggingJob.queue_as :bookkeeping
|
|
|
|
|
|
|
|
assert_equal "active_jobs", NestedJob.queue_name
|
2014-05-18 10:24:30 -04:00
|
|
|
assert_equal "active_jobs_greetings", HelloJob.queue_name
|
2014-06-09 12:49:14 -04:00
|
|
|
assert_equal "active_jobs_bookkeeping", LoggingJob.queue_name
|
2014-05-18 10:24:30 -04:00
|
|
|
ensure
|
2014-06-09 12:49:14 -04:00
|
|
|
HelloJob.queue_name = LoggingJob.queue_name = ActiveJob::Base.queue_base_name
|
2014-05-18 10:24:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|