Sha256: 3416f92c01e78503a6ebcdcfc5e46eaf0f0afe2a272ebef9d309f92b64be376c
Contents?: true
Size: 1.76 KB
Versions: 4
Compression:
Stored size: 1.76 KB
Contents
# Mostly copied from Resque in order to have similar test environment. # https://github.com/defunkt/resque/blob/master/test/test_helper.rb dir = File.dirname(File.expand_path(__FILE__)) $LOAD_PATH.unshift dir + '/../lib' $TESTING = true require 'test/unit' require 'rubygems' require 'resque' begin require 'leftright' rescue LoadError end require 'resque' require 'resque-sliders/kewatcher' # # 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 next if $! if defined?(MiniTest) exit_code = MiniTest::Unit.new.run(ARGV) else exit_code = Test::Unit::AutoRunner.run end pid = `ps -A -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 exit_code end 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 # file:lib/test/spec/mini.rb # 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
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
resque-sliders-0.2.3 | test/test_helper.rb |
resque-sliders-0.2.2 | test/test_helper.rb |
resque-sliders-0.2.1 | test/test_helper.rb |
resque-sliders-0.2.0 | test/test_helper.rb |