Sha256: 33ca6bd4d497ab7d923de67529a3a064fed5dcd5ab564fc8eba3fe47032de991

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

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

describe DataMapper::Persistence do
    
  it 'should allow mass-assignment of attributes' do
    zoo = Zoo.new(:name => 'MassAssignment', :notes => 'This is a test.')
    
    zoo.name.should eql('MassAssignment')
    zoo.notes.should eql('This is a test.')
    
    zoo.attributes = { :name => 'ThroughAttributesEqual', :notes => 'This is another test.' }
    
    zoo.name.should eql('ThroughAttributesEqual')
    zoo.notes.should eql('This is another test.')
  end
  
  it "should allow custom setters" do
    zoo = Zoo.new
    
    zoo.name = 'Colorado Springs'
    zoo.name.should eql("Cheyenne Mountain")
  end
  
  it "should call custom setters on mass-assignment" do
    zoo = Zoo.new(:name => 'Colorado Springs')
    
    zoo.name.should eql("Cheyenne Mountain")
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.2.5 spec/attributes_spec.rb