Sha256: 55aceb8a0b925d71e871919ca94b0ec372aefac5c35632ebc773759d3e4f1941
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
# encoding: UTF-8 require File.expand_path("./helper", File.dirname(__FILE__)) setup do init Redis.new(OPTIONS) end load './test/lint/strings.rb' test "MGET" do |r| r.set("foo", "s1") r.set("bar", "s2") assert ["s1", "s2"] == r.mget("foo", "bar") assert ["s1", "s2", nil] == r.mget("foo", "bar", "baz") end test "MGET mapped" do |r| r.set("foo", "s1") r.set("bar", "s2") response = r.mapped_mget("foo", "bar") assert "s1" == response["foo"] assert "s2" == response["bar"] response = r.mapped_mget("foo", "bar", "baz") assert "s1" == response["foo"] assert "s2" == response["bar"] assert nil == response["baz"] end test "Mapped MGET in a pipeline returns hash" do |r| r.set("foo", "s1") r.set("bar", "s2") result = r.pipelined do r.mapped_mget("foo", "bar") end assert result[0] == { "foo" => "s1", "bar" => "s2" } end test "MSET" do |r| r.mset(:foo, "s1", :bar, "s2") assert "s1" == r.get("foo") assert "s2" == r.get("bar") end test "MSET mapped" do |r| r.mapped_mset(:foo => "s1", :bar => "s2") assert "s1" == r.get("foo") assert "s2" == r.get("bar") end test "MSETNX" do |r| r.set("foo", "s1") r.msetnx(:foo, "s2", :bar, "s3") assert "s1" == r.get("foo") assert nil == r.get("bar") end test "MSETNX mapped" do |r| r.set("foo", "s1") r.mapped_msetnx(:foo => "s2", :bar => "s3") assert "s1" == r.get("foo") assert nil == r.get("bar") end test "STRLEN" do |r| r.set "foo", "lorem" assert 5 == r.strlen("foo") end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gorsuch-redis-3.0.0.rc1 | test/commands_on_strings_test.rb |
redis-3.0.0.rc1 | test/commands_on_strings_test.rb |