diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-11-23 17:08:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 17:08:40 -0500 |
commit | f0330b620282b6c999679674ec54f7b2b9f83324 (patch) | |
tree | 4a14c61c63afd0a01e02f03c216e370541c702f8 /activejob/test/cases | |
parent | 34726ad8959079fea17a2f6ea7fc2bd4864255a6 (diff) | |
parent | b517347be1e229554093b061bd3fd7dbf9017f6a (diff) | |
download | rails-f0330b620282b6c999679674ec54f7b2b9f83324.tar.gz rails-f0330b620282b6c999679674ec54f7b2b9f83324.tar.bz2 rails-f0330b620282b6c999679674ec54f7b2b9f83324.zip |
Merge pull request #34376 from composerinteralia/default_queue_name
Allow using queue prefix with a default queue name
Diffstat (limited to 'activejob/test/cases')
-rw-r--r-- | activejob/test/cases/queue_naming_test.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/activejob/test/cases/queue_naming_test.rb b/activejob/test/cases/queue_naming_test.rb index b64a38f91e..4b43c7c3c5 100644 --- a/activejob/test/cases/queue_naming_test.rb +++ b/activejob/test/cases/queue_naming_test.rb @@ -7,7 +7,7 @@ require "jobs/nested_job" class QueueNamingTest < ActiveSupport::TestCase test "name derived from base" do - assert_equal "default", HelloJob.queue_name + assert_equal "default", HelloJob.new.queue_name end test "uses given queue name job" do @@ -97,6 +97,33 @@ class QueueNamingTest < ActiveSupport::TestCase end end + test "using a custom default_queue_name" do + original_default_queue_name = ActiveJob::Base.default_queue_name + + begin + ActiveJob::Base.default_queue_name = "default_queue_name" + + assert_equal "default_queue_name", HelloJob.new.queue_name + ensure + ActiveJob::Base.default_queue_name = original_default_queue_name + end + end + + test "queue_name_prefix prepended to the default_queue_name" do + original_queue_name_prefix = ActiveJob::Base.queue_name_prefix + original_default_queue_name = ActiveJob::Base.default_queue_name + + begin + ActiveJob::Base.queue_name_prefix = "prefix" + ActiveJob::Base.default_queue_name = "default_queue_name" + + assert_equal "prefix_default_queue_name", HelloJob.new.queue_name + ensure + ActiveJob::Base.queue_name_prefix = original_queue_name_prefix + ActiveJob::Base.default_queue_name = original_default_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 |