Skip to content

Commit 0b8204b

Browse files
committed
the problem is that :as doesn't work in XML, as discussed here: #140
1 parent 8886960 commit 0b8204b

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/as_test.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,26 @@ class AsTest < MiniTest::Spec
4040
it { parse(song, {"[{:volume=>1}]" => "Wie Es Geht"}, :volume => 1).name.must_equal "Wie Es Geht" }
4141
end
4242
end
43+
end
44+
45+
46+
# hash: to_hash(wrap: ) is representation_wrap
47+
48+
class AsXmlTest < MiniTest::Spec
49+
Band = Struct.new(:name, :label)
50+
Album = Struct.new(:band)
51+
Label = Struct.new(:name)
52+
53+
representer!(module: Representable::XML, decorator: true) do
54+
self.representation_wrap = :album
55+
property :band, as: :combo do
56+
self.representation_wrap = :band
57+
property :name
58+
end
59+
end
60+
61+
it do
62+
skip
63+
representer.new(Album.new(Band.new("Offspring"))).to_xml.must_equal ""
64+
end
4365
end

0 commit comments

Comments
 (0)