Skip to content

Commit

Permalink
Add test for 'gets' command
Browse files Browse the repository at this point in the history
  • Loading branch information
makenowjust committed Jul 21, 2017
1 parent 201d842 commit a84761e
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions test/gets_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require_relative "test_helper"

describe "gets" do
it "can get cas unique" do
with_bashcached_and_client do |client|
expect_set client, value: "test"
expect_gets client, value: "test", cas_unique: 1
end
end

it "returns same cas unique when not changed" do
with_bashcached_and_client do |client|
expect_set client, value: "test"
expect_gets client, value: "test", cas_unique: 1
expect_gets client, value: "test", cas_unique: 1
end
end

it "returns another cas unique when changed" do
with_bashcached_and_client do |client|
expect_set client, value: "test1"
expect_gets client, value: "test1", cas_unique: 1
expect_set client, value: "test2"
expect_gets client, value: "test2", cas_unique: 2
end
end

it "returns another cas unique by each keys" do
with_bashcached_and_client do |client|
expect_set client, key: "test1", value: "test1"
expect_gets client, key: "test1", value: "test1", cas_unique: 1
expect_set client, key: "test2", value: "test2"
expect_gets client, key: "test2", value: "test2", cas_unique: 2
end
end

it "can get many keys at once" do
with_bashcached_and_client do |client|
expect_set client, key: "test1", value: "test1"
expect_set client, key: "test2", value: "test2"
expect_get_many client, {
"test1" => {value: "test1", cas_unique: 1},
"test2" => {value: "test2", cas_unique: 2},
}
end
end

it "can get flags" do
with_bashcached_and_client do |client|
expect_set client, value: "test", flags: 42
expect_gets client, value: "test", flags: 42, cas_unique: 1
end
end
end

0 comments on commit a84761e

Please sign in to comment.