diff --git a/lib/webrat/sinatra/sinatra_session.rb b/lib/webrat/sinatra/sinatra_session.rb index f770554..2647f6c 100644 --- a/lib/webrat/sinatra/sinatra_session.rb +++ b/lib/webrat/sinatra/sinatra_session.rb @@ -6,12 +6,12 @@ module Webrat class SinatraSession < RackSession include Sinatra::Test::Methods - def get(url, data, headers = nil) - get_it(url, data) - end - - def post(url, data, headers = nil) - post_it(url, data) + %w(get head post put delete).each do |verb| + define_method(verb) do |*args| + url, data, headers = *args + self.__send__("#{verb}_it", url, data) + follow! while @response.redirect? + end end end end \ No newline at end of file