Skip to content

Commit

Permalink
the problem is that :as doesn't work in XML, as discussed here: #140
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Jul 13, 2015
1 parent 8886960 commit 0b8204b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/as_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,26 @@ class AsTest < MiniTest::Spec
it { parse(song, {"[{:volume=>1}]" => "Wie Es Geht"}, :volume => 1).name.must_equal "Wie Es Geht" }
end
end
end


# hash: to_hash(wrap: ) is representation_wrap

class AsXmlTest < MiniTest::Spec
Band = Struct.new(:name, :label)
Album = Struct.new(:band)
Label = Struct.new(:name)

representer!(module: Representable::XML, decorator: true) do
self.representation_wrap = :album
property :band, as: :combo do
self.representation_wrap = :band
property :name
end
end

it do
skip
representer.new(Album.new(Band.new("Offspring"))).to_xml.must_equal ""
end
end

0 comments on commit 0b8204b

Please sign in to comment.