Skip to content

Commit

Permalink
Add test for absolute TTL
Browse files Browse the repository at this point in the history
Change-Id: I42f9e659692f90f844f42895286f97b31dd1d6a3
Reviewed-on: http://review.couchbase.org/13265
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Chris Anderson <jchris@couchbase.com>
  • Loading branch information
avsej authored and Chris Anderson committed Feb 21, 2012
1 parent 0722682 commit 3e55930
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_arithmetic.rb
Expand Up @@ -87,6 +87,17 @@ def test_it_allows_custom_ttl
refute connection.get(uniq_id(:missing))
end

def test_decrement_with_absolute_ttl
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
# absolute TTL: one second from now
exp = Time.now.to_i + 1
val = connection.decr(uniq_id, 12, :initial => 0, :ttl => exp)
assert_equal 0, val
assert_equal 0, connection.get(uniq_id)
sleep(2)
refute connection.get(uniq_id)
end

def test_it_allows_custom_delta
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)

Expand Down

0 comments on commit 3e55930

Please sign in to comment.