Sha256: c5a71729ccad0c971945fe55e001dbc768c5c5d025a502a04ef741846f6705b9
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 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
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-paranoia-2.0.0 | spec/mongoid/criteria/scopable_spec.rb |
mongoid-paranoia-2.0.0 | spec/mongoid/scoping_spec.rb |