Sha256: 40c0c71f3f80e614066ad6c744141b73ad7c2a605686450ed3e3ab3944354048
Contents?: true
Size: 596 Bytes
Versions: 37
Compression:
Stored size: 596 Bytes
Contents
require 'spec_helper' describe '#setnx(key, value)' do before { @key = 'mock-redis-test:setnx' } it "returns true if the key was absent" do @redises.setnx(@key, 1).should be_true end it "returns false if the key was present" do @redises.set(@key, 2) @redises.setnx(@key, 1).should be_false end it "sets the value if missing" do @redises.setnx(@key, 'value') @redises.get(@key).should == 'value' end it "does nothing if the value is present" do @redises.set(@key, 'old') @redises.setnx(@key, 'new') @redises.get(@key).should == 'old' end end
Version data entries
37 entries across 37 versions & 2 rubygems