mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:34:57 +08:00
DEV: Apply syntax_tree formatting to spec/*
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'cache'
|
||||
require "cache"
|
||||
|
||||
RSpec.describe Cache do
|
||||
|
||||
let :cache do
|
||||
Cache.new
|
||||
end
|
||||
@ -43,9 +42,7 @@ RSpec.describe Cache do
|
||||
it "can delete correctly" do
|
||||
cache.delete("key")
|
||||
|
||||
cache.fetch("key", expires_in: 1.minute) do
|
||||
"test"
|
||||
end
|
||||
cache.fetch("key", expires_in: 1.minute) { "test" }
|
||||
|
||||
expect(cache.fetch("key")).to eq("test")
|
||||
|
||||
@ -59,9 +56,7 @@ RSpec.describe Cache do
|
||||
|
||||
key = cache.normalize_key("key")
|
||||
|
||||
cache.fetch("key", expires_in: 1.minute) do
|
||||
"bob"
|
||||
end
|
||||
cache.fetch("key", expires_in: 1.minute) { "bob" }
|
||||
|
||||
expect(Discourse.redis.ttl(key)).to be_within(2.seconds).of(1.minute)
|
||||
|
||||
@ -75,9 +70,10 @@ RSpec.describe Cache do
|
||||
it "can store and fetch correctly" do
|
||||
cache.delete "key"
|
||||
|
||||
r = cache.fetch "key" do
|
||||
"bob"
|
||||
end
|
||||
r =
|
||||
cache.fetch "key" do
|
||||
"bob"
|
||||
end
|
||||
|
||||
expect(r).to eq("bob")
|
||||
end
|
||||
@ -85,9 +81,10 @@ RSpec.describe Cache do
|
||||
it "can fetch existing correctly" do
|
||||
cache.write "key", "bill"
|
||||
|
||||
r = cache.fetch "key" do
|
||||
"bob"
|
||||
end
|
||||
r =
|
||||
cache.fetch "key" do
|
||||
"bob"
|
||||
end
|
||||
expect(r).to eq("bill")
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user