test/test_helper.rb in resque-scheduler-1.0.6 vs test/test_helper.rb in resque-scheduler-1.8.0

- old
+ new

@@ -46,15 +46,33 @@ puts "Starting redis for testing at localhost:9736..." `redis-server #{dir}/redis-test.conf` Resque.redis = 'localhost:9736' +## +# test/spec/mini 3 +# http://gist.github.com/25455 +# chris@ozmm.org +# +def context(*args, &block) + return super unless (name = args.first) && block + require 'test/unit' + klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do + def self.test(name, &block) + define_method("test_#{name.gsub(/\W/,'_')}", &block) if block + end + def self.xtest(*args) end + def self.setup(&block) define_method(:setup, &block) end + def self.teardown(&block) define_method(:teardown, &block) end + end + (class << klass; self end).send(:define_method, :name) { name.gsub(/\W/,'_') } + klass.class_eval &block +end - class SomeJob def self.perform(repo_id, path) end end class SomeIvarJob < SomeJob @queue = :ivar -end \ No newline at end of file +end