Class: Capybara::Mechanize::Browser::ResponseProxy
- Inherits:
-
Object
- Object
- Capybara::Mechanize::Browser::ResponseProxy
- Extended by:
- Forwardable
- Defined in:
- lib/capybara/mechanize/browser.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #current_url ⇒ Object
- #headers ⇒ Object
-
#initialize(page) ⇒ ResponseProxy
constructor
A new instance of ResponseProxy.
- #redirect? ⇒ Boolean
- #status ⇒ Object
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
#page ⇒ Object (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_url ⇒ Object
228 229 230 |
# File 'lib/capybara/mechanize/browser.rb', line 228 def current_url page.uri.to_s end |
#headers ⇒ Object
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
243 244 245 |
# File 'lib/capybara/mechanize/browser.rb', line 243 def redirect? [301, 302].include?(status) end |
#status ⇒ Object
239 240 241 |
# File 'lib/capybara/mechanize/browser.rb', line 239 def status page.code.to_i end |