Class: Capybara::Mechanize::Browser::ResponseProxy

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/capybara/mechanize/browser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ ResponseProxy

Returns a new instance of ResponseProxy.



224
225
226
# File 'lib/capybara/mechanize/browser.rb', line 224

def initialize(page)
  @page = page
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



222
223
224
# File 'lib/capybara/mechanize/browser.rb', line 222

def page
  @page
end

Instance Method Details

#current_urlObject



228
229
230
# File 'lib/capybara/mechanize/browser.rb', line 228

def current_url
  page.uri.to_s
end

#headersObject



232
233
234
235
236
237
# File 'lib/capybara/mechanize/browser.rb', line 232

def headers
  # Hax the content-type contains utf8, so Capybara specs are failing, need to ask mailinglist
  headers = page.response
  headers["content-type"].gsub!(';charset=utf-8', '') if headers["content-type"]
  headers
end

#redirect?Boolean

Returns:

  • (Boolean)


243
244
245
# File 'lib/capybara/mechanize/browser.rb', line 243

def redirect?
  [301, 302].include?(status)
end

#statusObject



239
240
241
# File 'lib/capybara/mechanize/browser.rb', line 239

def status
  page.code.to_i
end