Sha256: 3a53733a8ce6ea2c5f51b447f3a6405c80a1c44dd363a153e5e712c20899df4f
Contents?: true
Size: 1.05 KB
Versions: 19
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true # encoding: utf-8 require "spec_helper" describe Mongo::QueryCache::Middleware do let :middleware do described_class.new(app) end context "when not touching query cache in the app" do let(:app) do lambda do |env| @enabled = Mongo::QueryCache.enabled? [200, env, "app"] end end it "returns success" do code, _ = middleware.call({}) expect(code).to eq(200) end it "enables the query cache" do middleware.call({}) expect(@enabled).to be true end end context "when querying in the app" do before do authorized_client['test'].insert_one(test: 1) end let(:app) do lambda do |env| authorized_client['test'].find [200, env, "app"] end end it "returns success" do code, _ = middleware.call({}) expect(code).to eq(200) end it "cleans the query cache after it responds" do middleware.call({}) expect(Mongo::QueryCache.send(:cache_table)).to be_empty end end end
Version data entries
19 entries across 19 versions & 1 rubygems