spec/property_spec.rb in langalex-couch_potato-0.2.7 vs spec/property_spec.rb in langalex-couch_potato-0.2.8

- old
+ new

@@ -1,6 +1,8 @@ require File.dirname(__FILE__) + '/spec_helper' +require File.join(File.dirname(__FILE__), 'fixtures', 'address') +require File.join(File.dirname(__FILE__), 'fixtures', 'person') class Watch include CouchPotato::Persistence property :time, :type => Time @@ -40,9 +42,26 @@ it "should persist a Time object" do w = Watch.new :time => Time.now CouchPotato.database.save_document! w w = CouchPotato.database.load_document w.id w.time.year.should == Time.now.year + end + + it "should persist an object" do + p = Person.new :name => 'Bob' + a = Address.new :city => 'Denver' + p.ship_address = a + CouchPotato.database.save_document! p + p = CouchPotato.database.load_document p.id + p.ship_address.should === a + end + + it "should persist null for a null " do + p = Person.new :name => 'Bob' + p.ship_address = nil + CouchPotato.database.save_document! p + p = CouchPotato.database.load_document p.id + p.ship_address.should be_nil end describe "predicate" do it "should return true if property set" do Comment.new(:title => 'title').title?.should be_true \ No newline at end of file