Sha256: b71ab6195292e28da93f4cb78d2c74ca1e1e86a9ed97aee6b3c37176093a8ea7

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

context 'A new record' do
  
  setup do
    @bob = Person.new(:name => 'Bob', :age => 30, :occupation => 'Sales')
  end
  
  specify 'should be dirty' do
    @bob.dirty?.should == true
  end
  
  specify 'set attributes should be dirty' do
    attributes = @bob.attributes.dup.reject { |k,v| k == :id }
    @bob.dirty_attributes.should == { :name => 'Bob', :age => 30, :occupation => 'Sales' }
  end
  
  specify 'should be marked as new' do
    @bob.new_record?.should == true
  end
  
  specify 'should have a nil id' do
    @bob.id.should == nil
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datamapper-0.1.1 spec/new_record.rb
datamapper-0.1.0 spec/new_record.rb