Sha256: 48d62dbb8a66a0329e1f76582104e14a0f813ada77c28ebf23d1e89ba5dd76b8
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
# frozen_string_literal: true require "spec_helper" describe Mongoid do describe ".configure" do context "when no block supplied" do it "returns the config singleton" do expect(Mongoid.configure).to eq(Mongoid::Config) end end context "when a block is supplied" do before do Mongoid.configure do |config| config.preload_models = true end end after do Mongoid.configure do |config| config.preload_models = false end end it "sets the values on the config instance" do expect(Mongoid.preload_models).to be true end end end describe ".default_client" do it "returns the default client" do expect(Mongoid.default_client).to eq(Mongoid::Clients.default) end end describe ".disconnect_clients" do let(:clients) do Mongoid::Clients.clients.values end before do Band.all.entries end it "disconnects from all active clients" do method_name = if Gem::Version.new(Mongo::VERSION) >= Gem::Version.new('2.19.0') :close else :disconnect! end clients.each do |client| expect(client.cluster).to receive(method_name).and_call_original end Mongoid.disconnect_clients end end describe ".client" do it "returns the named client" do expect(Mongoid.client(:default)).to eq(Mongoid::Clients.default) end end describe ".models" do it "returns the list of known models" do expect(Mongoid.models).to include(Band) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-7.5.4 | spec/mongoid_spec.rb |
mongoid-7.5.3 | spec/mongoid_spec.rb |