Permalink
Browse files

Add integration test with LocalCache to ensure we don't break it

  • Loading branch information...
chendo committed Dec 13, 2012
1 parent c3393a0 commit 2043dd2d15db54048e44c5672b2606498a8ba03d
Showing with 29 additions and 0 deletions.
  1. +29 −0 test/test_active_support.rb
@@ -147,6 +147,35 @@ def cache_key
end
end
+ should 'support read, write and delete with LocalCache' do
+ with_activesupport do
+ memcached do
+ connect
+ y = rand_key.to_s
+
+ @dalli.with_local_cache do
+ Dalli::Client.any_instance.expects(:get).with(y, {}).once.returns(123)
+ dres = @dalli.read(y)
+ assert_equal 123, dres
+
+ Dalli::Client.any_instance.expects(:get).with(y, {}).never
+
+ dres = @dalli.read(y)
+ assert_equal 123, dres
+
+ @dalli.write(y, 456)
+ dres = @dalli.read(y)
+ assert_equal 456, dres
+
+ @dalli.delete(y)
+ Dalli::Client.any_instance.expects(:get).with(y, {}).once.returns(nil)
+ dres = @dalli.read(y)
+ assert_equal nil, dres
+ end
+ end
+ end
+ end
+
should 'support increment/decrement commands' do
with_activesupport do
memcached do

0 comments on commit 2043dd2

Please sign in to comment.