Remove unused test for Redis cache store (#9102)

This commit is contained in:
rhymes 2020-07-05 21:13:19 +02:00 committed by GitHub
parent 9442fde9e7
commit 90c6e30972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,48 +0,0 @@
require "rails_helper"
RSpec.describe ActiveSupport::Cache::RedisCacheStore do
let(:redis_client) { ActiveSupport::Cache.lookup_store(:redis_cache_store).redis }
let(:cache_db) { described_class.new }
let(:key) { "monkey_patch_test" }
def value
cache_db.read(key, raw: true).to_i
end
def pttl
redis_client.pttl(key)
end
describe ".increment" do
before do
cache_db.delete(key)
end
it "increments value without expires_in" do
cache_db.increment(key)
expect(value).to eq(1)
expect(pttl).to eq(-1)
cache_db.increment(key)
expect(value).to eq(2)
expect(pttl).to eq(-1)
end
it "increments value with expires_in" do
cache_db.increment(key, 1, expires_in: 100.seconds)
first_pttl = pttl
expect(value).to eq(1)
expect(first_pttl > 0).to be_truthy
expect(first_pttl <= 100_000).to be_truthy
cache_db.increment(key, 1, expires_in: 200.seconds)
second_pttl = pttl
expect(value).to eq(2)
expect(second_pttl <= first_pttl).to be_truthy
end
end
end