mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Removed Hash#from_xml method from HTTParty and added regression spec to make sure HTTParty doesn't foobar ActiveSupport.
This commit is contained in:
parent
8591270358
commit
fc44b0b75a
3 changed files with 18 additions and 6 deletions
|
@ -285,11 +285,7 @@ class ToHashParser
|
|||
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
|
||||
|
|
|
@ -95,7 +95,7 @@ module HTTParty
|
|||
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
|
||||
|
|
16
spec/as_buggery_spec.rb
Normal file
16
spec/as_buggery_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue