lib/resque_spec/helpers.rb in resque_spec-0.5.1 vs lib/resque_spec/helpers.rb in resque_spec-0.6.0
- old
+ new
@@ -1,28 +1,13 @@
module ResqueSpec
module Helpers
def with_resque
- enable_perform
- yield
- disable_perform
- end
-
- private
-
- def enable_perform
- ::Resque.module_eval do
- def self.enqueue(klass, *args)
- klass.perform(*args)
- end
- end
- end
-
- def disable_perform
- ::Resque.module_eval do
- def self.enqueue(klass, *args)
- ::Resque::Job.create(ResqueSpec.queue_name(klass), klass, *args)
- end
+ begin
+ ResqueSpec.inline = true
+ yield
+ ensure
+ ResqueSpec.inline = false
end
end
end
end