1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/test/helper.rb
blake.mizerany@gmail.com 72be291da2 this is it
2007-09-08 23:51:24 +00:00

41 lines
662 B
Ruby

require File.dirname(__FILE__) + '/../lib/sinatra'
%w(mocha test/spec).each do |library|
begin
require library
rescue
STDERR.puts "== Sinatra's tests need #{library} to run."
end
end
Sinatra::Server.running = true
class Test::Unit::TestCase
def get_it(path)
request = Rack::MockRequest.new(Sinatra::Dispatcher.new)
@response = request.get path
end
def post_it(path)
request = Rack::MockRequest.new(Sinatra::Dispatcher.new)
@response = request.post path
end
def response
@response
end
def status
@response.status
end
def text
@response.body
end
def headers
@response.headers
end
end