spec/dynamoid/attributes_spec.rb in dynamoid-0.0.7 vs spec/dynamoid/attributes_spec.rb in dynamoid-0.1.0

- old
+ new

@@ -1,11 +1,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "Dynamoid::Attributes" do before do - @address = Address.new + @address = Address.create + @original_id = @address.id end it 'should write an attribute correctly' do @address.write_attribute(:city, 'Chicago') end @@ -26,15 +27,17 @@ it 'should update all attributes' do @address.expects(:save).once.returns(true) @address.update_attributes(:city => 'Chicago') @address[:city].should == 'Chicago' + @address.id.should == @original_id end it 'should update one attribute' do @address.expects(:save).once.returns(true) @address.update_attribute(:city, 'Chicago') @address[:city].should == 'Chicago' + @address.id.should == @original_id end it 'returns all attributes' do Address.attributes.should == [:id, :city] end