spec/commands/expire_spec.rb in mock_redis-0.11.0 vs spec/commands/expire_spec.rb in mock_redis-0.12.0
- old
+ new
@@ -37,32 +37,32 @@
@mock = @redises.mock
end
before do
@now = Time.now
- Time.stub!(:now).and_return(@now)
+ Time.stub(:now).and_return(@now)
end
it "removes keys after enough time has passed" do
@mock.expire(@key, 5)
- Time.stub!(:now).and_return(@now + 5)
+ Time.stub(:now).and_return(@now + 5)
@mock.get(@key).should be_nil
end
it "updates an existing expire time" do
@mock.expire(@key, 5)
@mock.expire(@key, 6)
- Time.stub!(:now).and_return(@now + 5)
+ Time.stub(:now).and_return(@now + 5)
@mock.get(@key).should_not be_nil
end
it "has millisecond precision" do
@now = Time.at(@now.to_i + 0.5)
- Time.stub!(:now).and_return(@now)
+ Time.stub(:now).and_return(@now)
@mock.expire(@key, 5)
- Time.stub!(:now).and_return(@now + 4.9)
+ Time.stub(:now).and_return(@now + 4.9)
@mock.get(@key).should_not be_nil
end
context "expirations on a deleted key" do
before { @mock.del(@key) }
@@ -71,11 +71,11 @@
@mock.set(@key, 'string')
@mock.expire(@key, 2)
@mock.del(@key)
@mock.set(@key, 'string')
- Time.stub!(:now).and_return(@now + 2)
+ Time.stub(:now).and_return(@now + 2)
@mock.get(@key).should_not be_nil
end
it "cleans up the expiration once the key is gone (list)" do
@@ -83,10 +83,10 @@
@mock.expire(@key, 2)
@mock.rpop(@key)
@mock.rpush(@key, 'coconuts')
- Time.stub!(:now).and_return(@now + 2)
+ Time.stub(:now).and_return(@now + 2)
@mock.lindex(@key, 0).should_not be_nil
end
end