spec/toy/persistence_spec.rb in toystore-0.6.1 vs spec/toy/persistence_spec.rb in toystore-0.6.2
- old
+ new
@@ -93,11 +93,10 @@
let(:doc) { @doc }
it "creates key in database with attributes" do
User.store.read(doc.store_key).should == {
'name' => 'John',
- 'id' => doc.id,
'age' => 50,
}
end
it "returns instance of model" do
@@ -284,20 +283,21 @@
end
end
describe "with cache store" do
before do
+ User.attribute(:name, String)
@cache = User.cache(:memory, {})
@memory = User.store(:memory, {})
- @user = User.create
+ @user = User.create(:name => 'John')
end
let(:cache) { @cache }
let(:memory) { @memory }
let(:user) { @user }
it "writes to cache and store" do
- cache[user.store_key].should == user.persisted_attributes
- memory[user.store_key].should == user.persisted_attributes
+ cache[user.store_key].should == {'name' => 'John'}
+ memory[user.store_key].should == {'name' => 'John'}
end
end
end
\ No newline at end of file