Class: Webrat::MechanizeAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/webrat_headers_patch.rb

Instance Method Summary collapse

Instance Method Details

#get_with_headers(url, data, headers = nil) ⇒ Object Also known as: get

Replace the Webrat version of get with one that doesn’t drop the headers param. Headers can be set using Webrat::Session#header (#header is available in your Tourist sublasses). For example:

class MyTests < Tourist

def before_tours
  header 'X-My-Header', 'something'
end


11
12
13
# File 'lib/webrat_headers_patch.rb', line 11

def get_with_headers(url, data, headers = nil)
  @response = mechanize.get({url: url, headers: headers}, data)
end