diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/queue_test.rb | 10 | ||||
-rw-r--r-- | railties/test/queueing/container_test.rb | 30 |
2 files changed, 35 insertions, 5 deletions
diff --git a/railties/test/application/queue_test.rb b/railties/test/application/queue_test.rb index 22d6c20404..83ca981336 100644 --- a/railties/test/application/queue_test.rb +++ b/railties/test/application/queue_test.rb @@ -20,14 +20,14 @@ module ApplicationTests test "the queue is a TestQueue in test mode" do app("test") - assert_kind_of Rails::Queueing::TestQueue, Rails.application.queue - assert_kind_of Rails::Queueing::TestQueue, Rails.queue + assert_kind_of Rails::Queueing::TestQueue, Rails.application.queue[:default] + assert_kind_of Rails::Queueing::TestQueue, Rails.queue[:default] end test "the queue is a Queue in development mode" do app("development") - assert_kind_of Rails::Queueing::Queue, Rails.application.queue - assert_kind_of Rails::Queueing::Queue, Rails.queue + assert_kind_of Rails::Queueing::Queue, Rails.application.queue[:default] + assert_kind_of Rails::Queueing::Queue, Rails.queue[:default] end class ThreadTrackingJob @@ -144,7 +144,7 @@ module ApplicationTests test "a custom queue implementation can be provided" do setup_custom_queue - assert_kind_of MyQueue, Rails.queue + assert_kind_of MyQueue, Rails.queue[:default] job = Struct.new(:id, :ran) do def run 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 |