diff options
author | Terry Meacham <zv1n.fire@gmail.com> | 2014-09-23 15:51:44 -0500 |
---|---|---|
committer | Terry Meacham <zv1n.fire@gmail.com> | 2014-10-26 21:46:05 -0500 |
commit | 11ab04b11170253e96515c3ada6f2566b092533a (patch) | |
tree | ce22987d118a311aef27a734357314b9994f58ef /activejob/test/cases | |
parent | 85faea4b8320e728854838c6da97c9435de8869e (diff) | |
download | rails-11ab04b11170253e96515c3ada6f2566b092533a.tar.gz rails-11ab04b11170253e96515c3ada6f2566b092533a.tar.bz2 rails-11ab04b11170253e96515c3ada6f2566b092533a.zip |
Added queue_name_delimiter attribute.
- Added ActiveJob::Base#queue_name_delimiter to allow for
developers using ActiveJob to change the delimiter from the default
('_') to whatever else they may be using (e.g., '.', '-', ...).
- Updated source guide to include a blurb about the delimiter.
Diffstat (limited to 'activejob/test/cases')
-rw-r--r-- | activejob/test/cases/queue_naming_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/activejob/test/cases/queue_naming_test.rb b/activejob/test/cases/queue_naming_test.rb index 886f41271a..898016a704 100644 --- a/activejob/test/cases/queue_naming_test.rb +++ b/activejob/test/cases/queue_naming_test.rb @@ -64,7 +64,7 @@ class QueueNamingTest < ActiveSupport::TestCase end end - test 'queu_name_prefix prepended to the queue name' do + test 'queue_name_prefix prepended to the queue name with default delimiter' do original_queue_name_prefix = ActiveJob::Base.queue_name_prefix original_queue_name = HelloJob.queue_name @@ -78,6 +78,23 @@ class QueueNamingTest < ActiveSupport::TestCase end end + test 'queue_name_prefix prepended to the queue name with custom delimiter' do + original_queue_name_prefix = ActiveJob::Base.queue_name_prefix + original_queue_name_delimiter = ActiveJob::Base.queue_name_delimiter + original_queue_name = HelloJob.queue_name + + begin + ActiveJob::Base.queue_name_delimiter = '.' + ActiveJob::Base.queue_name_prefix = 'aj' + HelloJob.queue_as :low + assert_equal 'aj.low', HelloJob.queue_name + ensure + ActiveJob::Base.queue_name_prefix = original_queue_name_prefix + ActiveJob::Base.queue_name_delimiter = original_queue_name_delimiter + HelloJob.queue_name = original_queue_name + end + end + test 'uses queue passed to #set' do job = HelloJob.set(queue: :some_queue).perform_later assert_equal "some_queue", job.queue_name |