Skip to content

Commit

Permalink
Add integration test with LocalCache to ensure we don't break it
Browse files Browse the repository at this point in the history
  • Loading branch information
chendo committed Dec 13, 2012
1 parent c3393a0 commit 2043dd2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/test_active_support.rb
Expand Up @@ -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
Expand Down

0 comments on commit 2043dd2

Please sign in to comment.