Sha256: 55298d924fc6a8ffdedb5ebc3fe9ac73f5ee64a8bbe2f1b45e5e205d3ea5a347
Contents?: true
Size: 1.23 KB
Versions: 17
Compression:
Stored size: 1.23 KB
Contents
require "spec_helper" describe Mongoid::Criteria::Scopable do context "when the document is paranoid" do context "when calling a class method" do let(:criteria) do Fish.fresh end it "includes the deleted_at criteria in the selector" do expect(criteria.selector).to eq({ "deleted_at" => nil, "fresh" => true }) end end context "when chaining a class method to unscoped" do let(:criteria) do Fish.unscoped.fresh end it "does not include the deleted_at in the selector" do expect(criteria.selector).to eq({ "fresh" => true }) end end context "when chaining a class method to deleted" do let(:criteria) do Fish.deleted.fresh end it "includes the deleted_at $ne criteria in the selector" do expect(criteria.selector).to eq({ "deleted_at" => { "$ne" => nil }, "fresh" => true }) end end context "when chaining a where to unscoped" do let(:criteria) do Fish.unscoped.where(fresh: true) end it "includes no default scoping information in the selector" do expect(criteria.selector).to eq({ "fresh" => true }) end end end end
Version data entries
17 entries across 11 versions & 3 rubygems