require 'rails_helper'
require 'cache'
describe "Redis Store" do
let :cache do
Cache.new(namespace: 'foo')
end
let :store do
DiscourseRedis.new_redis_store
before(:each) do
cache.redis.del "key"
store.delete "key"
it "can store stuff" do
store.fetch "key" do
"key in store"
r = store.read "key"
expect(r).to eq("key in store")
it "doesn't collide with our Cache" do
cache.fetch "key" do
"key in cache"
it "can be cleared without clearing our cache" do
store.clear
expect(store.read("key")).to eq(nil)
expect(cache.fetch("key")).to eq("key in cache")