Sha256: edef1efefe92c9d970f3d75f5f564c6ac80dd5395bb5791184050841e35a7775
Contents?: true
Size: 1002 Bytes
Versions: 16
Compression:
Stored size: 1002 Bytes
Contents
# frozen_string_literal: true require "spec_helper" describe Mongoid::QueryCache::Middleware do let :middleware do Mongoid::QueryCache::Middleware.new(app) end context "when not touching mongoid on the app" do let(:app) do ->(env) { @enabled = Mongoid::QueryCache.enabled?; [200, env, "app"] } 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 on the app" do let(:app) do ->(env) { Band.all.to_a [200, env, "app"] } end it "returns success" do code, _ = middleware.call({}) expect(code).to eq(200) end context 'with driver query cache' do it "cleans the query cache after it responds" do middleware.call({}) expect(Mongo::QueryCache.send(:cache_table)).to be_empty end end end end
Version data entries
16 entries across 16 versions & 1 rubygems