diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-10-10 08:53:22 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-10-10 08:55:17 +0200 |
commit | 64e64c6f041224fefc03bbfdd2dd86d494df1990 (patch) | |
tree | 376ac7c603abb1e29c6399644d4fb187d11818e0 /activejob/test | |
parent | 5f1a274b68ecd2945759e31be7ddcabe37f26611 (diff) | |
download | rails-64e64c6f041224fefc03bbfdd2dd86d494df1990.tar.gz rails-64e64c6f041224fefc03bbfdd2dd86d494df1990.tar.bz2 rails-64e64c6f041224fefc03bbfdd2dd86d494df1990.zip |
tests, move `original_` var assignments outside of `begin`.
Diffstat (limited to 'activejob/test')
-rw-r--r-- | activejob/test/cases/queue_naming_test.rb | 22 | ||||
-rw-r--r-- | activejob/test/integration/queuing_test.rb | 5 |
2 files changed, 16 insertions, 11 deletions
diff --git a/activejob/test/cases/queue_naming_test.rb b/activejob/test/cases/queue_naming_test.rb index 6658cf954c..886f41271a 100644 --- a/activejob/test/cases/queue_naming_test.rb +++ b/activejob/test/cases/queue_naming_test.rb @@ -9,8 +9,9 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'uses given queue name job' do + original_queue_name = HelloJob.queue_name + begin - original_queue_name = HelloJob.queue_name HelloJob.queue_as :greetings assert_equal "greetings", HelloJob.new.queue_name ensure @@ -19,8 +20,9 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'allows a blank queue name' do + original_queue_name = HelloJob.queue_name + begin - original_queue_name = HelloJob.queue_name HelloJob.queue_as "" assert_equal "", HelloJob.new.queue_name ensure @@ -29,8 +31,9 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'does not use a nil queue name' do + original_queue_name = HelloJob.queue_name + begin - original_queue_name = HelloJob.queue_name HelloJob.queue_as nil assert_equal "default", HelloJob.new.queue_name ensure @@ -39,8 +42,9 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'evals block given to queue_as to determine queue' do + original_queue_name = HelloJob.queue_name + begin - original_queue_name = HelloJob.queue_name HelloJob.queue_as { :another } assert_equal "another", HelloJob.new.queue_name ensure @@ -49,8 +53,9 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'can use arguments to determine queue_name in queue_as block' do + original_queue_name = HelloJob.queue_name + begin - original_queue_name = HelloJob.queue_name HelloJob.queue_as { self.arguments.first=='1' ? :one : :two } assert_equal "one", HelloJob.new('1').queue_name assert_equal "two", HelloJob.new('3').queue_name @@ -60,10 +65,10 @@ class QueueNamingTest < ActiveSupport::TestCase end test 'queu_name_prefix prepended to the queue name' do - begin - original_queue_name_prefix = ActiveJob::Base.queue_name_prefix - original_queue_name = HelloJob.queue_name + original_queue_name_prefix = ActiveJob::Base.queue_name_prefix + original_queue_name = HelloJob.queue_name + begin ActiveJob::Base.queue_name_prefix = 'aj' HelloJob.queue_as :low assert_equal 'aj_low', HelloJob.queue_name @@ -77,5 +82,4 @@ class QueueNamingTest < ActiveSupport::TestCase job = HelloJob.set(queue: :some_queue).perform_later assert_equal "some_queue", job.queue_name end - end diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb index 779dedb53f..219be11509 100644 --- a/activejob/test/integration/queuing_test.rb +++ b/activejob/test/integration/queuing_test.rb @@ -10,9 +10,10 @@ class QueuingTest < ActiveSupport::TestCase end test 'should not run jobs queued on a non-listenting queue' do + skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) + old_queue = TestJob.queue_name + begin - skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) - old_queue = TestJob.queue_name TestJob.queue_as :some_other_queue TestJob.perform_later @id wait_for_jobs_to_finish_for(2.seconds) |