lib/qs/job_handler.rb in qs-0.5.0 vs lib/qs/job_handler.rb in qs-0.6.0
- old
+ new
@@ -1,16 +1,16 @@
+require 'much-plugin'
require 'qs/message_handler'
module Qs
module JobHandler
+ include MuchPlugin
- def self.included(klass)
- klass.class_eval do
- include Qs::MessageHandler
- include InstanceMethods
- end
+ plugin_included do
+ include Qs::MessageHandler
+ include InstanceMethods
end
module InstanceMethods
def inspect
@@ -23,9 +23,25 @@
# Helpers
def job; @qs_runner.message; end
def job_name; job.name; end
def job_created_at; job.created_at; end
+
+ end
+
+ module TestHelpers
+
+ def self.included(klass)
+ require 'qs/test_runner'
+ end
+
+ def test_runner(handler_class, args = nil)
+ Qs::JobTestRunner.new(handler_class, args)
+ end
+
+ def test_handler(handler_class, args = nil)
+ test_runner(handler_class, args).handler
+ end
end
end