Expose current DOM (as an Hpricot object) as current_dom. Fix SSL support

This commit is contained in:
Bryan Helmkamp 2008-08-10 16:32:03 -04:00
parent f0ffd19be1
commit 549f462f65
4 changed files with 21 additions and 12 deletions

View File

@ -10,6 +10,7 @@
* Minor enhancements
* Expose current DOM (as an Hpricot object) as current_dom
* Add support for disabling JavaScript when clicking a link to enable testing of both JS
and non-JS implementations (Luke Melia and Bryan Helmkamp)
* Support &nbsp's as spaces in matching link text (Patch from Luke Melia)

View File

@ -162,6 +162,18 @@ module Webrat
alias_method :click_button, :clicks_button
def dom # :nodoc:
return @dom if defined?(@dom) && @dom
@dom = Hpricot(@html)
if @selector
html = (@dom / @selector).first.to_html
@dom = Hpricot(html)
end
return @dom
end
protected
def find_select_option(option_text, id_or_name_or_label)
@ -224,17 +236,5 @@ module Webrat
end
end
def dom # :nodoc:
return @dom if defined?(@dom) && @dom
@dom = Hpricot(@html)
if @selector
html = (@dom / @selector).first.to_html
@dom = Hpricot(html)
end
return @dom
end
end
end

View File

@ -30,6 +30,10 @@ module Webrat
open_in_browser(filename)
end
def current_dom
current_scope.dom
end
# For backwards compatibility -- removing in 1.0
def current_page
page = OpenStruct.new

View File

@ -15,18 +15,22 @@ module Webrat
end
def get(url, data)
update_protocol(url)
@integration_session.get_via_redirect(url, data)
end
def post(url, data)
update_protocol(url)
@integration_session.post_via_redirect(url, data)
end
def put(url, data)
update_protocol(url)
@integration_session.put_via_redirect(url, data)
end
def delete(url, data)
update_protocol(url)
@integration_session.delete_via_redirect(url, data)
end