Sha256: 494152a768db13ab902d44d66a6985dba7d806a15b1d6357090ee81c43183dd0
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
begin require 'rack' rescue LoadError require 'rubygems' require 'rack' end libdir = File.dirname(File.dirname(__FILE__)) + '/lib' $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir) require 'sinatra/base' require 'sinatra/test/unit' module Sinatra::Test # Sets up a Sinatra::Base subclass defined with the block # given. Used in setup or individual spec methods to establish # the application. def mock_app(base=Sinatra::Base, &block) @app = Sinatra.new(base, &block) end end class Sinatra::Base # Allow assertions in request context include Test::Unit::Assertions end ## # test/spec/mini # http://pastie.caboo.se/158871 # chris@ozmm.org # def describe(*args, &block) return super unless (name = args.first) && block name = "#{name.gsub(/\W/, '')}Test" Object.send :const_set, name, Class.new(Test::Unit::TestCase) klass = Object.const_get(name) klass.class_eval do def self.it(name, &block) define_method("test_#{name.gsub(/\W/,'_').downcase}", &block) end def self.xspecify(*args) end def self.before(&block) define_method(:setup, &block) end def self.after(&block) define_method(:teardown, &block) end end klass.class_eval &block end # Do not output warnings for the duration of the block. def silence_warnings $VERBOSE, v = nil, $VERBOSE yield ensure $VERBOSE = v end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
bmizerany-sinatra-0.9.0.5 | test/helper.rb |
sinatra-sinatra-0.9.0.5 | test/helper.rb |