Sha256: 2cd99f144d4be9cb8440040aff2920d13b54f41e44c082481afa53ff44297c30

Contents?: true

Size: 1.02 KB

Versions: 42

Compression:

Stored size: 1.02 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.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.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.options).to eq({ :skip => 5, :limit => -1 })
        end
      end
    end
  end
end

Version data entries

42 entries across 39 versions & 3 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/mongo-2.5.1/spec/mongo/operation/limited_spec.rb
mongo-2.5.1 spec/mongo/operation/limited_spec.rb
mongo-2.5.0 spec/mongo/operation/limited_spec.rb
mongo-2.5.0.beta spec/mongo/operation/limited_spec.rb
mongo-2.4.3 spec/mongo/operation/limited_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/limited_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/mongo/operation/limited_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/limited_spec.rb
mongo-2.4.2 spec/mongo/operation/limited_spec.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/limited_spec.rb
mongo-2.4.1 spec/mongo/operation/limited_spec.rb
mongo-2.4.0 spec/mongo/operation/limited_spec.rb
mongo-2.3.1 spec/mongo/operation/limited_spec.rb
mongo-2.4.0.rc1 spec/mongo/operation/limited_spec.rb
mongo-2.4.0.rc0 spec/mongo/operation/limited_spec.rb
mongo-2.3.0 spec/mongo/operation/limited_spec.rb
mongo-2.2.7 spec/mongo/operation/limited_spec.rb
mongo-2.2.6 spec/mongo/operation/limited_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/mongo/operation/limited_spec.rb
mongo-2.2.5 spec/mongo/operation/limited_spec.rb