-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds tests and read ttl functionality #11
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Cassava | ||
VERSION = "0.1.2" | ||
VERSION = "0.1.3" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,25 @@ def string_keys(hash) | |
end | ||
end | ||
|
||
context 'select_ttl' do | ||
should 'allow an existing ttl to be read' do | ||
ttl = 12345 | ||
item = { :id => 'i', :a => 1, :b => 'b', :c => "'\"item(", :d => 1, :ttl => ttl } | ||
@client.insert(:test, item) | ||
|
||
resulting_ttl = @client.select_ttl(:test, :d, {:id => 'i'}) | ||
assert (1..ttl).include? resulting_ttl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. depending on how long the query takes to execute the TTL could be less than it originally was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, now I get it |
||
end | ||
|
||
should 'return nil if there is no ttl set on a cell' do | ||
item = { :id => 'i', :a => 1, :b => 'b', :c => "'\"item(", :d => 1 } | ||
@client.insert(:test, item) | ||
|
||
resulting_ttl = @client.select_ttl(:test, :d, {:id => 'i'}) | ||
assert resulting_ttl.nil? | ||
end | ||
end | ||
|
||
context 'delete' do | ||
setup do | ||
@client.insert(:test, :id => 'i', :a => 2, :b => 'a', :c => '1', :d => 1) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to see one more test with two where_arguments (one integer and one string) just to fully exercise that
select_ttl_statement
method ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good idea i can do that