Sha256: 130610542e08c978ca5e9fd44642611d6fadf28b005a7b31ae1bd491e15af7c7

Contents?: true

Size: 431 Bytes

Versions: 27

Compression:

Stored size: 431 Bytes

Contents

require 'spec_helper'

describe 'Criteria and default scope' do

  context 'order in query' do
    let(:query) do
      Acolyte.order(status: :desc)
    end

    let(:sort_options) do
      query.options[:sort]
    end

    it 'is added after order of default scope' do
      sort_options.should == {'status' => -1, 'name' => 1}

      # Keys in Ruby are ordered
      sort_options.keys.should == %w(name status)
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongoid-7.3.5 spec/integration/criteria/default_scope_spec.rb
mongoid-7.3.4 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.11 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.6 spec/integration/criteria/default_scope_spec.rb
mongoid-7.3.3 spec/integration/criteria/default_scope_spec.rb
mongoid-7.3.2 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.5 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.10 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.9 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.4 spec/integration/criteria/default_scope_spec.rb
mongoid-7.3.1 spec/integration/criteria/default_scope_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/integration/criteria/default_scope_spec.rb
mongoid-7.3.0 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.3 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.8 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.2 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.1 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.7 spec/integration/criteria/default_scope_spec.rb
mongoid-7.2.0 spec/integration/criteria/default_scope_spec.rb
mongoid-7.1.6 spec/integration/criteria/default_scope_spec.rb