Commit 6e1d618de80c76b1d0d13ed0ae97414c8ed76946
1 parent
79a5e556
Exists in
master
and in
29 other branches
Fixed delayed_job for the Test environment
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
vendor/plugins/delayed_job/lib/delayed/message_sending.rb
@@ -8,6 +8,10 @@ module Delayed | @@ -8,6 +8,10 @@ module Delayed | ||
8 | end | 8 | end |
9 | 9 | ||
10 | def method_missing(method, *args) | 10 | def method_missing(method, *args) |
11 | + if (Rails.env == "test" or Rails.env == "cucumber") | ||
12 | + @target.send method, *args | ||
13 | + return | ||
14 | + end | ||
11 | Job.create({ | 15 | Job.create({ |
12 | :payload_object => PerformableMethod.new(@target, method.to_sym, args), | 16 | :payload_object => PerformableMethod.new(@target, method.to_sym, args), |
13 | :priority => ::Delayed::Worker.default_priority | 17 | :priority => ::Delayed::Worker.default_priority |
@@ -33,7 +37,7 @@ module Delayed | @@ -33,7 +37,7 @@ module Delayed | ||
33 | 37 | ||
34 | module ClassMethods | 38 | module ClassMethods |
35 | def handle_asynchronously(method) | 39 | def handle_asynchronously(method) |
36 | - return if (Rails.env == "test" or Rails.env == "cucumber") | 40 | + return if (Rails.env == "test" or Rails.env == "cucumber") |
37 | aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1 | 41 | aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1 |
38 | with_method, without_method = "#{aliased_method}_with_delay#{punctuation}", "#{aliased_method}_without_delay#{punctuation}" | 42 | with_method, without_method = "#{aliased_method}_with_delay#{punctuation}", "#{aliased_method}_without_delay#{punctuation}" |
39 | define_method(with_method) do |*args| | 43 | define_method(with_method) do |*args| |