Sha256: 66c9f1ef76c7952f52d70d0517b8d3bf18e38f2a727da3ba342700dc1de7a46b
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
require 'spec_helper' describe "#hdel(key, field)" do before do @key = "mock-redis-test:hdel" @redises.hset(@key, 'k1', 'v1') @redises.hset(@key, 'k2', 'v2') end it "returns 1 when it removes a field" do @redises.hdel(@key, 'k1').should == 1 end it "returns 0 when it does not remove a field" do @redises.hdel(@key, 'nonesuch').should == 0 end it "actually removes the field" do @redises.hdel(@key, 'k1') @redises.hget(@key, 'k1').should be_nil end it "treats the field as a string" do field = 2 @redises.hset(@key, field, 'two') @redises.hdel(@key, field) @redises.hget(@key, field).should be_nil end it "removes only the field specified" do @redises.hdel(@key, 'k1') @redises.hget(@key, 'k2').should == 'v2' end it "cleans up empty hashes" do @redises.hdel(@key, 'k1') @redises.hdel(@key, 'k2') @redises.get(@key).should be_nil end it_should_behave_like "a hash-only command" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mock_redis-0.4.1 | spec/commands/hdel_spec.rb |