Sha256: d5b300cc8d0d36fa34009c3ea5de36cc948a70333198fa5843699559da2dfc49
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
dir = File.dirname(File.expand_path(__FILE__)) $LOAD_PATH.unshift dir + '/../lib' $TESTING = true require 'test/unit' require 'rubygems' require 'resque' # # make sure we can run redis # if !system("which redis-server") puts '', "** can't find `redis-server` in your path" puts "** try running `sudo rake install`" abort '' end # # start our own redis when the tests start, # kill it when they end # at_exit do unless $! || Test::Unit.run? status = Test::Unit::AutoRunner.run pid = `ps -e -o pid,command | grep [r]edis-test`.split(" ")[0] puts "Killing test redis server..." `rm -f #{dir}/dump.rdb` Process.kill("KILL", pid.to_i) exit status end end puts "Starting redis for testing at localhost:9736..." `redis-server #{dir}/redis-test.conf` Resque.redis = 'localhost:9736' ## # test/spec/mini 2 # 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 klass.class_eval &block end # # fixture classes # class SomeJob def self.perform(repo_id, path) end end class SomeIvarJob < SomeJob @queue = :ivar end class SomeMethodJob < SomeJob def self.queue :method end end class BadJob def self.perform raise "Bad job!" end end class GoodJob def self.perform(name) "Good job, #{name}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resque-1.2.0 | test/test_helper.rb |