diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-19 12:09:39 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-19 12:09:39 -0700 |
commit | 3b3ca133071419a42c0b1f55c96fc604ff73f2ac (patch) | |
tree | ed88fbf05020aa8ee637a9dff0bcb6cddc2fb223 /railties/test/queueing/container_test.rb | |
parent | fa3c84fabee01847c3468cd1e8e32003693bc629 (diff) | |
download | rails-3b3ca133071419a42c0b1f55c96fc604ff73f2ac.tar.gz rails-3b3ca133071419a42c0b1f55c96fc604ff73f2ac.tar.bz2 rails-3b3ca133071419a42c0b1f55c96fc604ff73f2ac.zip |
adding Rails::Queueing::Container
This allows us to do:
In your configuration:
Rails.queue[:image_queue] = SomeQueue.new
Rails.queue[:mail_queue] = SomeQueue.new
In your app code:
Rails.queue[:mail_queue].push MailJob.new
Both jobs pushed to the same default queue
Rails.queue.push DefaultJob.new
Rails.queue[:default].push DefaultJob.new
Diffstat (limited to 'railties/test/queueing/container_test.rb')
-rw-r--r-- | railties/test/queueing/container_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/queueing/container_test.rb b/railties/test/queueing/container_test.rb new file mode 100644 index 0000000000..69e59a3871 --- /dev/null +++ b/railties/test/queueing/container_test.rb @@ -0,0 +1,30 @@ +require 'abstract_unit' +require 'rails/queueing' + +module Rails + module Queueing + class ContainerTest < ActiveSupport::TestCase + def test_delegates_to_default + q = Queue.new + container = Container.new q + job = Object.new + + container.push job + assert_equal job, q.pop + end + + def test_access_default + q = Queue.new + container = Container.new q + assert_equal q, container[:default] + end + + def test_assign_queue + container = Container.new Object.new + q = Object.new + container[:foo] = q + assert_equal q, container[:foo] + end + end + end +end |