spec/toy/attributes_spec.rb in toystore-0.6.1 vs spec/toy/attributes_spec.rb in toystore-0.6.2

- old
+ new

@@ -50,10 +50,14 @@ it "includes embedded" do @game.persisted_attributes.should have_key('moves') end + it "includes ids of embedded" do + @game.persisted_attributes['moves'][0].should have_key('id') + end + it "does not include virtual attributes" do @game.persisted_attributes.should_not have_key(:creator_score) end it "includes to_store values for attributes" do @@ -325,9 +329,15 @@ before do User.attribute(:name, String) @user = User.create(:name => 'John') end let(:user) { @user } + + it "reloads id from database" do + id = user.id + user.reload + user.id.should == id + end it "reloads record from the database" do user.name = 'Steve' user.reload user.name.should == 'John' \ No newline at end of file