test/xml_test.rb in representable-0.12.0 vs test/xml_test.rb in representable-0.13.0

- old
+ new

@@ -2,10 +2,11 @@ require 'representable/xml' class Band include Representable::XML property :name + attr_accessor :name def initialize(name=nil) name and self.name = name end end @@ -22,10 +23,11 @@ @Band = Class.new do include Representable::XML self.representation_wrap = :band property :name property :label + attr_accessor :name, :label end @band = @Band.new end @@ -157,10 +159,13 @@ end civ = Object.new civ.instance_eval do def name; "CIV"; end + def name=(v) + @name = v + end end civ.extend(BandRepresenter) assert_xml_equal "<object><name>CIV</name></object>", civ.to_xml end @@ -192,10 +197,11 @@ describe ":from => @rel" do class Link include Representable::XML property :href, :from => "@href" property :title, :from => "@title" + attr_accessor :href, :title end it "#from_xml creates correct accessors" do link = Link.from_xml(%{ <a href="http://apotomo.de" title="Home, sweet home" /> @@ -219,10 +225,11 @@ property :band, :class => Band end class Album + attr_accessor :band def initialize(band=nil) @band = band end end @@ -269,10 +276,11 @@ class CollectionTest < MiniTest::Spec describe ":class => Band, :from => :band, :collection => true" do class Compilation include Representable::XML collection :bands, :class => Band, :from => :band + attr_accessor :bands end describe "#from_xml" do it "pushes collection items to array" do cd = Compilation.from_xml(%{ @@ -307,9 +315,10 @@ describe ":from" do class Album include Representable::XML collection :songs, :from => :song + attr_accessor :songs end it "collects untyped items" do album = Album.from_xml(%{ <album>