spec/extensions/shared_caching_spec.rb in sequel-4.41.0 vs spec/extensions/shared_caching_spec.rb in sequel-4.42.0
- old
+ new
@@ -26,11 +26,11 @@
@db.sqls.must_equal []
@c.load(:id=>3, :caching_model_id=>1, :caching_model_id2=>2).caching_model2.must_be_same_as(@cm12)
@c.load(:id=>3, :caching_model_id=>2, :caching_model_id2=>1).caching_model2.must_be_same_as(@cm21)
@db.sqls.must_equal []
@db.fetch = []
- @c.load(:id=>4, :caching_model_id=>2, :caching_model_id2=>2).caching_model2.must_equal nil
+ @c.load(:id=>4, :caching_model_id=>2, :caching_model_id2=>2).caching_model2.must_be_nil
end
end
many_to_one_pk_specs = shared_description do
it "should use a simple primary key lookup when retrieving many_to_one associated records" do
@@ -38,11 +38,11 @@
@db.sqls.must_equal []
@c.load(:id=>3, :caching_model_id=>1).caching_model.must_be_same_as(@cm1)
@c.load(:id=>4, :caching_model_id=>2).caching_model.must_be_same_as(@cm2)
@db.sqls.must_equal []
@db.fetch = []
- @c.load(:id=>4, :caching_model_id=>3).caching_model.must_equal nil
+ @c.load(:id=>4, :caching_model_id=>3).caching_model.must_be_nil
end
it "should not use a simple primary key lookup if the assocation has a nil :key option" do
@c.many_to_one :caching_model, :key=>nil, :dataset=>proc{CachingModel.filter(:caching_model_id=>caching_model_id)}
@c.load(:id=>3, :caching_model_id=>1).caching_model
@@ -91,11 +91,10 @@
@c.load(:id=>3, :caching_model_id=>1).caching_model
@db.sqls.must_equal []
end
it "should not use a simple primary key lookup if the prepared_statements_associations method is being used" do
- c2 = Class.new(Sequel::Model(@db[:not_caching_model]))
- c2.dataset._fetch = {:id=>1}
+ c2 = Class.new(Sequel::Model(@db[:not_caching_model].with_fetch(:id=>1)))
c = Class.new(Sequel::Model(@db[:lookup_model]))
c.class_eval do
plugin :prepared_statements_associations
columns :id, :caching_model_id
many_to_one :caching_model, :class=>c2