From 6d108393be2b60b03ec5e5abb1bba3f97d79b885 Mon Sep 17 00:00:00 2001 From: Nicolas Sanguinetti Date: Mon, 29 Dec 2008 01:40:14 -0200 Subject: [PATCH] Allow accessing the request and response from SinatraSession --- lib/webrat/sinatra.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb index c365387..6c7f291 100644 --- a/lib/webrat/sinatra.rb +++ b/lib/webrat/sinatra.rb @@ -5,11 +5,13 @@ require 'sinatra/test/methods' module Webrat class SinatraSession < RackSession #:nodoc: include Sinatra::Test::Methods + + attr_reader :request, :response %w(get head post put delete).each do |verb| define_method(verb) do |*args| # (path, data, headers = nil) path, data, headers = *args - params = data.merge({:env => headers || {}}) + params = data.merge(:env => headers || {}) self.__send__("#{verb}_it", path, params) get_it(@response.location, params) while @response.redirect? end