Skip to content
Browse files

Failing spec for multiple primitves

  • Loading branch information...
1 parent 741b7d5 commit 6635900aa35f2b414cd14c953f4b80107219a589 @knaveofdiamonds committed May 27, 2009
Showing with 20 additions and 0 deletions.
  1. +5 −0 spec/fixtures/multiple_primitives.xml
  2. +15 −0 spec/happymapper_spec.rb
View
5 spec/fixtures/multiple_primitives.xml
@@ -0,0 +1,5 @@
+<artist>
+ <image>image1</image>
+ <image>image2</image>
+ <name>value</name>
+</artist>
View
15 spec/happymapper_spec.rb
@@ -270,6 +270,15 @@ class Commit
end
end
+# To check for multiple primitives
+class Artist
+ include HappyMapper
+
+ tag 'artist'
+ element :images, String, :tag => "image", :single => false
+ element :name, String
+end
+
describe HappyMapper do
describe "being included into another class" do
@@ -561,4 +570,10 @@ module Bar; class Baz; include HappyMapper; end; end
# tree.people.first.modified.should == Time.utc(2008, 1, 3, 16, 41, 31) # 2008-01-03T09:41:31-07:00
# tree.people.first.id.should == 'KWQS-BBQ'
end
+
+ it "should parse multiple images" do
+ artist = Artist.parse(fixture_file('multiple_primitives.xml'))
+ artist.name.should == "value"
+ artist.images.size.should == 2
+ end
end

0 comments on commit 6635900

Please sign in to comment.
Something went wrong with that request. Please try again.