aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/queueing.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/queueing.rb')
-rw-r--r--railties/lib/rails/queueing.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/rails/queueing.rb b/railties/lib/rails/queueing.rb
index b4bc7fcd18..8a76914548 100644
--- a/railties/lib/rails/queueing.rb
+++ b/railties/lib/rails/queueing.rb
@@ -22,6 +22,13 @@ module Rails
@que.dup
end
+ # Marshal and unmarshal job before pushing it onto the queue. This will
+ # raise an exception on any attempts in tests to push jobs that can't (or
+ # shouldn't) be marshalled.
+ def push(job)
+ super Marshal.load(Marshal.dump(job))
+ end
+
# Drain the queue, running all jobs in a different thread. This method
# may not be available on production queues.
def drain