Sha256: 636bf5aa8db8ce8996a2db390c6679ed9cb1ae5ebdfa1a138fa174a47612bbd5
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' class Test include CouchPotato::Persistence property :test, :default => 'Test value' property :complex, :default => [1, 2, 3] property :false_value, :default => false end describe 'default properties' do before(:all) do recreate_db end it "should use the default value if nothing is supplied" do t = Test.new t.test.should == 'Test value' end it "should persist the default value if nothing is supplied" do t = Test.new CouchPotato.database.save_document! t t = CouchPotato.database.load_document t.id t.test.should == 'Test value' end it "should not have the same default for two instances of the object" do t = Test.new t2 = Test.new t.complex.object_id.should_not == t2.complex.object_id end it "should not return the default value when the actual value is empty" do t = Test.new(:complex => []).complex.should == [] end it "uses the default value also if the default is false" do t = Test.new t.false_value.should == false end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
couch_potato-0.7.1 | spec/default_property_spec.rb |
couch_potato-0.7.0 | spec/default_property_spec.rb |
couch_potato-0.7.0.pre.1 | spec/default_property_spec.rb |