Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/xmlrpc/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def self.struct(hash)
begin
mod = Module
klass.split("::").each {|const| mod = mod.const_get(const.strip)}
return hash unless mod.included_modules.include?(XMLRPC::Marshallable)

obj = mod.allocate

Expand Down
3 changes: 3 additions & 0 deletions test/data/marshallable.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- true
- ___class___: Gem::Requirement
17 changes: 17 additions & 0 deletions test/data/marshallable.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" ?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>___class___</name>
<value>
<string>Gem::Requirement</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
7 changes: 7 additions & 0 deletions test/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def setup
@datetime_xml = File.read(datafile('datetime_iso8601.xml'))
@datetime_expected = XMLRPC::DateTime.new(2004, 11, 5, 1, 15, 23)

@marshallable_xml, @marshallable_expected = load_data('marshallable')

@fault_doc = File.read(datafile('fault.xml'))
@marshallable = File.read(datafile('marshallable.xml'))
end

# test parseMethodResponse --------------------------------------------------
Expand All @@ -50,6 +53,10 @@ def test_dateTime
assert_equal(@datetime_expected, @p.parseMethodResponse(@datetime_xml)[1])
end

def test_marshallable
assert_equal(@marshallable_expected, @p.parseMethodResponse(@marshallable))
end

# test parseMethodCall ------------------------------------------------------

def test_parseMethodCall
Expand Down