diff options
Diffstat (limited to 'activejob/test/jobs')
-rw-r--r-- | activejob/test/jobs/queue_as_job.rb | 10 | ||||
-rw-r--r-- | activejob/test/jobs/rescue_job.rb | 2 | ||||
-rw-r--r-- | activejob/test/jobs/translated_hello_job.rb | 10 |
3 files changed, 21 insertions, 1 deletions
diff --git a/activejob/test/jobs/queue_as_job.rb b/activejob/test/jobs/queue_as_job.rb new file mode 100644 index 0000000000..897aef52e5 --- /dev/null +++ b/activejob/test/jobs/queue_as_job.rb @@ -0,0 +1,10 @@ +require_relative '../support/job_buffer' + +class QueueAsJob < ActiveJob::Base + MY_QUEUE = :low_priority + queue_as MY_QUEUE + + def perform(greeter = "David") + JobBuffer.add("#{greeter} says hello") + end +end diff --git a/activejob/test/jobs/rescue_job.rb b/activejob/test/jobs/rescue_job.rb index f1b9c9349e..4f6376c850 100644 --- a/activejob/test/jobs/rescue_job.rb +++ b/activejob/test/jobs/rescue_job.rb @@ -11,7 +11,7 @@ class RescueJob < ActiveJob::Base rescue_from(ActiveJob::DeserializationError) do |e| JobBuffer.add('rescued from DeserializationError') - JobBuffer.add("DeserializationError original exception was #{e.original_exception.class.name}") + JobBuffer.add("DeserializationError original exception was #{e.cause.class.name}") end def perform(person = "david") diff --git a/activejob/test/jobs/translated_hello_job.rb b/activejob/test/jobs/translated_hello_job.rb new file mode 100644 index 0000000000..9657cd3f54 --- /dev/null +++ b/activejob/test/jobs/translated_hello_job.rb @@ -0,0 +1,10 @@ +require_relative '../support/job_buffer' + +class TranslatedHelloJob < ActiveJob::Base + def perform(greeter = "David") + translations = { en: 'Hello', de: 'Guten Tag' } + hello = translations[I18n.locale] + + JobBuffer.add("#{greeter} says #{hello}") + end +end |