Permalink
Browse files

Define a SynchronousQueue for test in Action Pack.

We don't need to rely on rails/queueing in Action Pack tests
  • Loading branch information...
1 parent 45537f0 commit d0c25f253f43acba6ce27a1d3116c16fa4d3b536 @rafaelfranca committed Sep 12, 2012
Showing with 10 additions and 6 deletions.
  1. +0 −6 actionpack/test/abstract_unit.rb
  2. +10 −0 actionpack/test/controller/assert_select_test.rb
@@ -26,7 +26,6 @@
require 'active_record'
require 'action_controller/caching'
require 'action_controller/caching/sweeping'
-require 'rails/queueing'
require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
@@ -35,11 +34,6 @@ class << self
def env
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "test")
end
-
- def queue
- @queue ||= Rails::Queueing::Container.new(Rails::Queueing::SynchronousQueue.new)
- end
-
end
end
@@ -10,6 +10,16 @@
require 'action_mailer'
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
+class SynchronousQueue < Queue
+ def push(job)
+ job.run
+ end
+ alias << push
+ alias enq push
+end
+
+ActionMailer::Base.queue = SynchronousQueue.new
+
class AssertSelectTest < ActionController::TestCase
Assertion = ActiveSupport::TestCase::Assertion

0 comments on commit d0c25f2

Please sign in to comment.