Skip to content

Commit

Permalink
Clean up Webrat remains
Browse files Browse the repository at this point in the history
  • Loading branch information
mvz committed Oct 18, 2014
1 parent ae53b20 commit 4bf7947
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions spec/rails_helper.rb
Expand Up @@ -179,30 +179,3 @@ def parse_validator_messages(message)
[true, ""]
end
end

# Make webrat's matchers treat XML like XML.
# See Webrat ticket #345.
# Solution adapted from the following patch:
# http://github.com/indirect/webrat/commit/46b8d91c962e802fbcb14ee0bcf03aab1afa180a
module Webrat #:nodoc:
module XML #:nodoc:

def self.document(stringlike) #:nodoc:
return stringlike.dom if stringlike.respond_to?(:dom)

case stringlike
when Nokogiri::HTML::Document, Nokogiri::XML::NodeSet
stringlike
else
stringlike = stringlike.body if stringlike.respond_to?(:body)

if stringlike.to_s =~ /\<\?xml/
Nokogiri::XML(stringlike.to_s)
else
Nokogiri::HTML(stringlike.to_s)
end
end
end
end
end

0 comments on commit 4bf7947

Please sign in to comment.