test/test_padrino_cache.rb in padrino-cache-0.13.0.beta3 vs test/test_padrino_cache.rb in padrino-cache-0.13.0
- old
+ new
@@ -477,6 +477,33 @@
while adapter.respond_to? :adapter
adapter = adapter.adapter
end
assert_kind_of Moneta::Adapters::Memory, adapter
end
+
+ it "should check key existence" do
+ count1, count2 = 0, 0
+ mock_app do
+ register Padrino::Cache
+ enable :caching
+ get "/" do
+ cache(:foo) do
+ count1 += 1
+ nil
+ end
+ count1.inspect
+ end
+
+ get "/object" do
+ cache_object(:bar) do
+ count2 += 1
+ nil
+ end
+ count2.inspect
+ end
+ end
+ 2.times { get "/" }
+ assert_equal "1", body
+ 2.times { get "/object" }
+ assert_equal "1", body
+ end
end