Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. module Webrat
  2. class SinatraSession < RackSession #:nodoc:
  3. include Sinatra::Test::Methods
  4.  
  5. attr_reader :request, :response
  6.  
  7. %w(get head post put delete).each do |verb|
  8. define_method(verb) do |*args| # (path, data, headers = nil)
  9. path, data, headers = *args
  10. params = data.merge(:env => headers || {})
  11. self.__send__("#{verb}_it", path, params)
  12. request_page(@response.location, :get, {}) while @response.redirect?
  13. pp current_url
  14. end
  15. end
  16. end
  17. end
Add Comment
Please, Sign In to add comment