Sha256: 9a6d798fc3bda448948c1bc835948ec05abedc5535aa736344d4e8cdec9c9c31

Contents?: true

Size: 1.04 KB

Versions: 39

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Mongo::Operation::Limited do

  describe '#options' do

    let(:limited) do
      Class.new do
        include Mongo::Operation::Specifiable
        include Mongo::Operation::Limited
      end.new({ :options => spec })
    end

    context 'when no limit is provided' do

      let(:spec) do
        { :skip => 5 }
      end

      it 'returns a limit of -1' do
        expect(limited.send(:options)).to eq({ :skip => 5, :limit => -1 })
      end
    end

    context 'when a limit is already provided' do

      context 'when the limit is -1' do

        let(:spec) do
          { :skip => 5, :limit => -1 }
        end

        it 'returns a limit of -1' do
          expect(limited.send(:options)).to eq({ :skip => 5, :limit => -1 })
        end
      end

      context 'when the limit is not -1' do

        let(:spec) do
          { :skip => 5, :limit => 5 }
        end

        it 'returns a limit of -1' do
          expect(limited.send(:options)).to eq({ :skip => 5, :limit => -1 })
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/mongo/operation/limited_spec.rb
mongo-2.12.4 spec/mongo/operation/limited_spec.rb
mongo-2.11.6 spec/mongo/operation/limited_spec.rb
mongo-2.12.3 spec/mongo/operation/limited_spec.rb
mongo-2.12.2 spec/mongo/operation/limited_spec.rb
mongo-2.10.5 spec/mongo/operation/limited_spec.rb
mongo-2.11.5 spec/mongo/operation/limited_spec.rb
mongo-2.12.1 spec/mongo/operation/limited_spec.rb
mongo-2.12.0.rc0 spec/mongo/operation/limited_spec.rb
mongo-2.11.4 spec/mongo/operation/limited_spec.rb
mongo-2.10.4 spec/mongo/operation/limited_spec.rb
mongo-2.11.3 spec/mongo/operation/limited_spec.rb
mongo-2.11.2 spec/mongo/operation/limited_spec.rb
mongo-2.11.1 spec/mongo/operation/limited_spec.rb
mongo-2.10.3 spec/mongo/operation/limited_spec.rb
mongo-2.11.0 spec/mongo/operation/limited_spec.rb
mongo-2.9.2 spec/mongo/operation/limited_spec.rb
mongo-2.10.2 spec/mongo/operation/limited_spec.rb
mongo-2.11.0.rc0 spec/mongo/operation/limited_spec.rb
mongo-2.10.1 spec/mongo/operation/limited_spec.rb