Sha256: 2c05cff6b8d29eca4be889b43e7508a5cf65affe14b1a40aeb0da67a6d1c005d
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
require 'pathname' require Pathname(__FILE__).dirname.expand_path + 'spec_helper' describe DataMapper::IdentityMaps do class Name include DataMapper::Resource property :id, Serial property :name, String end DataMapper.auto_migrate! class App def initialize(status = 200, headers = "", response = "", &block) @status, @headers, @response, @block = status, headers, response, block end def call(env) @block.call [@status, @headers, @response] end end after :each do Name.all.destroy! end it 'should collect resources loaded from the datasource' do app = App.new do Name.create(:name => 'first') repository.identity_map(Name).size.should == 1 Name.create(:name => 'second') repository.identity_map(Name).size.should == 2 Name.create(:name => 'third') repository.identity_map(Name).size.should == 3 end DataMapper::IdentityMaps.new(app).call(nil) Name.all.size.should == 3 repository.identity_map(Name).size.should == 0 end end
Version data entries
7 entries across 7 versions & 1 rubygems