Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed Hash#from_xml method from HTTParty and added regression spec …

…to make sure HTTParty doesn't foobar ActiveSupport.
  • Loading branch information...
commit fc44b0b75a8ed321bc7f89f6dfa54fcae24b4723 1 parent 8591270
@jnunemaker authored
View
6 lib/core_extensions.rb
@@ -285,11 +285,7 @@ def self.from_xml(xml)
end
end
-class Hash
- def self.from_xml(xml)
- ToHashParser.from_xml(xml)
- end
-
+class Hash
# @return <String> This hash as a query string
#
# @example
View
2  lib/httparty/request.rb
@@ -95,7 +95,7 @@ def parse_response(body) #:nodoc:
return nil if body.nil? or body.empty?
case format
when :xml
- Hash.from_xml(body)
+ ToHashParser.from_xml(body)
when :json
JSON.parse(body)
else
View
16 spec/as_buggery_spec.rb
@@ -0,0 +1,16 @@
+require File.join(File.dirname(__FILE__), 'spec_helper')
+
+require 'activesupport'
+
+describe Hash do
+ describe "#from_xml" do
+ it "should be able to convert xml with datetimes" do
+ xml =<<EOL
+<?xml version="1.0" encoding="UTF-8"?>
+<created-at type="datetime">2008-12-01T20:00:00-05:00</created-at>
+EOL
+ hsh = Hash.from_xml(xml)
+ hsh["created_at"].should == Time.parse("December 01st, 2008 20:00:00")
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.