diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-04-27 09:51:11 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-04-27 09:51:11 -0700 |
commit | cd50b60431881b808d596f394befd38a2d453603 (patch) | |
tree | 10fa3c4c94e42005884b8067c57a46f479f0e701 | |
parent | 8de4d71f5dab243f2c66e1695ccfabc0bbf98c9b (diff) | |
download | rails-cd50b60431881b808d596f394befd38a2d453603.tar.gz rails-cd50b60431881b808d596f394befd38a2d453603.tar.bz2 rails-cd50b60431881b808d596f394befd38a2d453603.zip |
add a factory method for queue construction so that apps can have multiple queues
-rw-r--r-- | railties/lib/rails/application.rb | 6 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 6ab448910e..1680a6ed00 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -200,7 +200,11 @@ module Rails end def queue #:nodoc: - @queue ||= config.queue.new + @queue ||= build_queue + end + + def build_queue # :nodoc: + config.queue.new end def to_app diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index ac5ac2b93e..252dd0e31a 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -41,6 +41,14 @@ module ApplicationTests FileUtils.rm_rf(new_app) if File.directory?(new_app) end + test "multiple queue construction is possible" do + require 'rails' + require "#{app_path}/config/environment" + mail_queue = Rails.application.build_queue + image_processing_queue = Rails.application.build_queue + assert_not_equal mail_queue, image_processing_queue + end + test "Rails.groups returns available groups" do require "rails" |