Sha256: 43b64309a7b9ec23b11cdee6c59e0aec383538072b5c756fa84e58460cb938cf
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require File.dirname(__FILE__) + "/spec_helper" describe DataMapper::Base do it "attributes method should load all lazy-loaded values" do Animal.first(:name => 'Cup').attributes[:notes].should == 'I am a Cup!' end it "mass assignment should call methods" do class Animal attr_reader :test def test=(value) @test = value + '!' end end a = Animal.new(:test => 'testing') a.test.should == 'testing!' end end describe 'A new record' do before(:each) do @bob = Person.new(:name => 'Bob', :age => 30, :occupation => 'Sales') end it 'should be dirty' do @bob.dirty?.should == true end it '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 it 'should be marked as new' do @bob.new_record?.should == true end it '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.2.2 | spec/base_spec.rb |
datamapper-0.2.1 | spec/base_spec.rb |