Sha256: b5fe438dc76d510a34c25c7b05dc93bd1493eee6ffdc34f61464830bf24c704c

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 Bytes

Contents

require "redis"
require "econfig/redis"

describe Econfig::Redis do
  let(:redis) { Redis.new(:databse => "econfig_test") }
  let(:backend) { Econfig::Redis.new(redis) }
  after do |example|
    redis.flushdb
  end
  describe "#get" do
    it "fetches a previously set option" do
      backend.set("foo", "bar")
      backend.get("foo").should == "bar"
    end

    it "fetches a previously persisted option" do
      redis.set("foo", "bar")
      backend.get("foo").should == "bar"
    end

    it "returns nil if option is not set" do
      backend.get("foo").should be_nil
    end
  end

  describe "#set" do
    it "persists keys to database" do
      backend.set("foo", "bar")
      redis.get("foo").should == "bar"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
econfig-1.0.2 spec/redis_spec.rb
econfig-1.0.1 spec/redis_spec.rb
econfig-1.0.0 spec/redis_spec.rb