test/save_test.rb in identity_cache-0.0.2 vs test/save_test.rb in identity_cache-0.0.3
- old
+ new
@@ -5,19 +5,19 @@
super
Record.cache_index :title, :unique => true
Record.cache_index :id, :title, :unique => true
@record = Record.create(:title => 'bob')
- @blob_key = "IDC:blob:Record:#{cache_hash("created_at:datetime,id:integer,title:string,updated_at:datetime")}:1"
+ @blob_key = "IDC:blob:Record:#{cache_hash("created_at:datetime,id:integer,record_id:integer,title:string,updated_at:datetime")}:1"
end
def test_create
@record = Record.new
@record.title = 'bob'
IdentityCache.cache.expects(:delete).with("IDC:index:Record:id/title:#{cache_hash('2/bob')}")
IdentityCache.cache.expects(:delete).with("IDC:index:Record:title:#{cache_hash('bob')}")
- IdentityCache.cache.expects(:delete).with("IDC:blob:Record:#{cache_hash("created_at:datetime,id:integer,title:string,updated_at:datetime")}:2").once
+ IdentityCache.cache.expects(:delete).with("IDC:blob:Record:#{cache_hash("created_at:datetime,id:integer,record_id:integer,title:string,updated_at:datetime")}:2").once
@record.save
end
def test_update
# Regular flow, write index id, write index id/tile, delete data blob since Record has changed