spec/happymapper_spec.rb in happymapper-0.3.2 vs spec/happymapper_spec.rb in happymapper-0.4.0
- old
+ new
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper'
require 'pp'
require 'uri'
require 'support/models'
describe HappyMapper do
@@ -140,11 +140,11 @@
first.time.should == Time.utc(2008, 8, 9, 5, 24, 20)
first.others.should == 56
first.extended.should == 'ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML. Using simple annotations, it enables Ruby classes to be custom-mapped to XML. ROXML takes care of the marshalling and unmarshalling of mapped attributes so that developers can focus on building first-class Ruby classes.'
end
- it "should parse xml elements to ruby objcts" do
+ it "should parse xml elements to ruby objects" do
statuses = Status.parse(fixture_file('statuses.xml'))
statuses.size.should == 20
first = statuses.first
first.id.should == 882281424
first.created_at.should == Time.utc(2008, 8, 9, 5, 38, 12)
@@ -169,9 +169,16 @@
address.street.should == 'Milchstrasse'
address.postcode.should == '26131'
address.housenumber.should == '23'
address.city.should == 'Oldenburg'
address.country.should == 'Germany'
+ end
+
+ it "should parse xml containing a has many relationship with primitive types" do
+ address = MultiStreetAddress.parse(fixture_file('multi_street_address.xml'), :single => true)
+ address.should_not be_nil
+ address.street_address.first.should == "123 Smith Dr"
+ address.street_address.last.should == "Apt 31"
end
it "should parse xml with default namespace (amazon)" do
file_contents = fixture_file('pita.xml')
items = PITA::Items.parse(file_contents, :single => true)