Sha256: 528ae3ab185e08cfc77261db823813a6c2c205c74b9bcb4cb39861460ebf9ad2
Contents?: true
Size: 954 Bytes
Versions: 13
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 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 "enableds 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 it "cleans the query cache after reponds" do middleware.call({}) expect(Mongoid::QueryCache.cache_table).to be_empty end end end
Version data entries
13 entries across 13 versions & 2 rubygems