Allow accessing the request and response from SinatraSession
This commit is contained in:
parent
2ead102f54
commit
6d108393be
@ -5,11 +5,13 @@ require 'sinatra/test/methods'
|
|||||||
module Webrat
|
module Webrat
|
||||||
class SinatraSession < RackSession #:nodoc:
|
class SinatraSession < RackSession #:nodoc:
|
||||||
include Sinatra::Test::Methods
|
include Sinatra::Test::Methods
|
||||||
|
|
||||||
|
attr_reader :request, :response
|
||||||
|
|
||||||
%w(get head post put delete).each do |verb|
|
%w(get head post put delete).each do |verb|
|
||||||
define_method(verb) do |*args| # (path, data, headers = nil)
|
define_method(verb) do |*args| # (path, data, headers = nil)
|
||||||
path, data, headers = *args
|
path, data, headers = *args
|
||||||
params = data.merge({:env => headers || {}})
|
params = data.merge(:env => headers || {})
|
||||||
self.__send__("#{verb}_it", path, params)
|
self.__send__("#{verb}_it", path, params)
|
||||||
get_it(@response.location, params) while @response.redirect?
|
get_it(@response.location, params) while @response.redirect?
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user