Sha256: 2ba94904dd3ae8f7e6dc75d16a80b47fafd58965591eb7d979f96d72f02af8d8

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

require File.expand_path("../../test_helper", __FILE__)

module GemExt
  class TestRedis < MiniTest::Test

    describe Redis do
      describe "#set" do
        describe "when passing TTL" do
          it "invokes set, followed with expire" do
            redis = Redis.new
            redis.expects(:set_without_cached_record).with(:foo, :bar, {})
            redis.expects(:expire).with(:foo, 10)
            redis.set :foo, :bar, 10
          end
        end
        describe "when passing options hash" do
          it "invokes set" do
            redis = Redis.new
            redis.expects(:set_without_cached_record).with(:foo, :bar, {:ex => 5})
            redis.set :foo, :bar, {:ex => 5}
          end
        end
      end

      describe "#delete" do
        it "calls del" do
          redis = Redis.new
          redis.expects(:del).with(:foo, :bar)
          redis.delete :foo, :bar
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cached_record-0.1.1 test/gem_ext/test_redis.rb
cached_record-0.1.0 test/gem_ext/test_redis.rb