Sha256: 97e36830c1f824153bb21ca3ff02d7c989511996752543c0ff1c709a4ff50f6b

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

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

describe "Dynamoid::Attributes" do

  before do
    @address = Address.new
  end

  it 'should write an attribute correctly' do
    @address.write_attribute(:city, 'Chicago')
  end
  
  it 'should write an attribute with the alias' do
    @address[:city] = 'Chicago'
  end
  
  it 'should read a written attribute' do
    @address.write_attribute(:city, 'Chicago')
    @address.read_attribute(:city).should == 'Chicago'
  end
  
  it 'should read a written attribute with the alias' do
    @address.write_attribute(:city, 'Chicago')
    @address[:city].should == 'Chicago'
  end
  
  it 'should update all attributes' do
    @address.expects(:save).once.returns(true)
    @address.update_attributes(:city => 'Chicago')
    @address[:city].should == 'Chicago'
  end
  
  it 'should update one attribute' do
    @address.expects(:save).once.returns(true)
    @address.update_attribute(:city, 'Chicago')
    @address[:city].should == 'Chicago'
  end
  
  it 'returns all attributes' do
    Address.attributes.should == [:id, :city]
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dynamoid-0.0.7 spec/dynamoid/attributes_spec.rb
dynamoid-0.0.6 spec/dynamoid/attributes_spec.rb
dynamoid-0.0.5 spec/dynamoid/attributes_spec.rb
dynamoid-0.0.4 spec/dynamoid/attributes_spec.rb
dynamoid-0.0.3 spec/dynamoid/attributes_spec.rb
dynamoid-0.0.2 spec/dynamoid/attributes_spec.rb