mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Make the first argument to the top-level describe a constant in specs
This commit is contained in:

committed by
Loïc Guitaut

parent
8b8cbe7905
commit
00b3f0e2c4
@ -245,4 +245,56 @@ RSpec.describe DiscourseRedis do
|
||||
expect(redis_proxy.calls).to eq([:evalsha, :eval, :evalsha, :evalsha])
|
||||
end
|
||||
end
|
||||
|
||||
describe ".new_redis_store" do
|
||||
let(:cache) { Cache.new(namespace: 'foo') }
|
||||
let(:store) { DiscourseRedis.new_redis_store }
|
||||
|
||||
before do
|
||||
cache.redis.del("key")
|
||||
store.delete("key")
|
||||
end
|
||||
|
||||
it "can store stuff" do
|
||||
store.fetch("key") do
|
||||
"key in store"
|
||||
end
|
||||
|
||||
r = store.read("key")
|
||||
|
||||
expect(r).to eq("key in store")
|
||||
end
|
||||
|
||||
it "doesn't collide with our Cache" do
|
||||
store.fetch("key") do
|
||||
"key in store"
|
||||
end
|
||||
|
||||
cache.fetch("key") do
|
||||
"key in cache"
|
||||
end
|
||||
|
||||
r = store.read("key")
|
||||
|
||||
expect(r).to eq("key in store")
|
||||
end
|
||||
|
||||
it "can be cleared without clearing our cache" do
|
||||
cache.clear
|
||||
store.clear
|
||||
|
||||
store.fetch("key") do
|
||||
"key in store"
|
||||
end
|
||||
|
||||
cache.fetch("key") do
|
||||
"key in cache"
|
||||
end
|
||||
|
||||
store.clear
|
||||
|
||||
expect(store.read("key")).to eq(nil)
|
||||
expect(cache.fetch("key")).to eq("key in cache")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user