Created
November 3, 2009 13:57
-
-
Save jeroenvandijk/225061 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hack needed to be compatible with webrat | |
module Webrat | |
class SeleniumSession | |
extend Forwardable | |
# Add more methods of webrat/core/session when needed | |
def_delegators :current_scope, :field_labeled, :table_at, :css_search | |
def within(selector) | |
scopes.push(Webrat::Scope.from_scope(self, current_scope, selector)) | |
ret = yield(current_scope) | |
scopes.pop | |
return ret | |
end | |
def current_scope | |
scopes.last || page_scope | |
end | |
def page_scope | |
Webrat::Scope.from_page(self, response, response_body) | |
end | |
def scopes | |
@_scopes ||= [] | |
end | |
def xml_content_type? | |
false | |
end | |
def current_dom #:nodoc: | |
current_scope.dom | |
end | |
def elements | |
{} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment