Sha256: 9455395453f7d46548315999e2981052f25c0faf0a74b0206ba88fa2734ea94b
Contents?: true
Size: 1.22 KB
Versions: 6
Compression:
Stored size: 1.22 KB
Contents
# encoding: UTF-8 require File.expand_path("./helper", File.dirname(__FILE__)) begin Ohm.redis.script("flush") rescue RuntimeError # We're running on Redis < 2.6, so we # skip all the test. else setup do Ohm::Lua.new("./test/lua", Ohm.redis) end test do |lua| lua.redis.set("foo", "baz") res = lua.run_file("getset", :keys => ["foo"], :argv => ["bar"]) assert_equal ["baz", "bar"], res end test do |lua| res = lua.run_file("ohm-save", :keys => ["User"], :argv => ["fname", "John", "lname", "Doe"]) assert lua.redis.sismember("User:all", 1) assert_equal({ "fname" => "John", "lname" => "Doe" }, lua.redis.hgetall("User:1")) end test do |lua| lua.redis.sadd("User:indices", "fname") lua.redis.sadd("User:indices", "lname") res = lua.run_file("save-with-indices", :keys => ["User:1", "User:all", "User:indices"], :argv => ["fname", "John", "lname", "Doe"]) assert lua.redis.sismember("User:all", 1) assert lua.redis.sismember("User:fname:John", 1) assert lua.redis.sismember("User:lname:Doe", 1) assert lua.redis.sismember("User:1:_indices", "User:fname:John") assert lua.redis.sismember("User:1:_indices", "User:lname:Doe") end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
ohm-1.0.2 | test/lua.rb |
ohm-1.0.1 | test/lua.rb |
ohm-1.0.0 | test/lua.rb |
ohm-1.0.0.rc4 | test/lua.rb |
ohm-1.0.0.rc3 | test/lua.rb |
ohm-1.0.0.rc2 | test/lua.rb |