Sha256: 6c4c36e409ae13db3673fcad9bd9f65187bc0a64a6c3f241cfe1d332b3a332ff

Contents?: true

Size: 769 Bytes

Versions: 13

Compression:

Stored size: 769 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

class Test
  include CouchPotato::Persistence

  property :test, :default => 'Test value'
  property :complex, :default => []
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
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
langalex-couch_potato-0.2.11 spec/default_property_spec.rb
langalex-couch_potato-0.2.12 spec/default_property_spec.rb
langalex-couch_potato-0.2.9 spec/default_property_spec.rb
couch_potato-0.2.21 spec/default_property_spec.rb
couch_potato-0.2.20 spec/default_property_spec.rb
couch_potato-0.2.19 spec/default_property_spec.rb
couch_potato-0.2.18 spec/default_property_spec.rb
couch_potato-0.2.17 spec/default_property_spec.rb
couch_potato-0.2.16 spec/default_property_spec.rb
couch_potato-0.2.15 spec/default_property_spec.rb
couch_potato-0.2.14 spec/default_property_spec.rb
couch_potato-0.2.13 spec/default_property_spec.rb
couch_potato-0.2.12 spec/default_property_spec.rb