mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
c00a25ee41
* Adds test/helper.rb and moves mock_app and other code specific to testing the framework out of Sinatra::Test. * Do not require test/unit. The sinatra/test/unit, sinatra/test/spec, and sinatra/test/rspec files can be used to choose the framework. * Add Sinatra::TestHarness, which should act similar to the Rack::Session proposal here: http://gist.github.com/41270 * Update the README with information on using the different test frameworks.
30 lines
653 B
Ruby
30 lines
653 B
Ruby
require 'rubygems'
|
|
require 'mocha'
|
|
|
|
# disable warnings in compat specs.
|
|
$VERBOSE = nil
|
|
|
|
$:.unshift File.dirname(File.dirname(__FILE__)) + "/lib"
|
|
|
|
ENV['RACK_ENV'] ||= 'test'
|
|
|
|
require 'sinatra'
|
|
require 'sinatra/test'
|
|
require 'sinatra/test/unit'
|
|
require 'sinatra/test/spec'
|
|
|
|
module Sinatra::Test
|
|
# we need to remove the new test helper methods since they conflict with
|
|
# the top-level methods of the same name.
|
|
%w(get head post put delete).each do |verb|
|
|
remove_method verb
|
|
end
|
|
include Sinatra::Delegator
|
|
end
|
|
|
|
class Test::Unit::TestCase
|
|
include Sinatra::Test
|
|
def setup
|
|
@app = lambda { |env| Sinatra::Application.call(env) }
|
|
end
|
|
end
|