Sha256: 610a8e5e7916953b7908b7d33adfe2061068f2d9442a7a8b295f1fff3ddbcece

Contents?: true

Size: 674 Bytes

Versions: 18

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'lite_spec_helper'

describe Mongo::Id do
  it 'starts with ID 1' do
    class IdA
      include Mongo::Id
    end

    expect(IdA.next_id).to eq(1)
  end

  it 'increases each subsequent ID' do
    class IdB
      include Mongo::Id
    end

    expect(IdB.next_id).to eq(1)
    expect(IdB.next_id).to eq(2)
  end

  it 'correctly generates independent IDs for separate classes' do
    class IdC
      include Mongo::Id
    end

    class IdD
      include Mongo::Id
    end

    expect(IdC.next_id).to eq(1)
    expect(IdD.next_id).to eq(1)
    expect(IdC.next_id).to eq(2)
    expect(IdD.next_id).to eq(2)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/mongo/id_spec.rb
mongo-2.17.4 spec/mongo/id_spec.rb
mongo-2.18.3 spec/mongo/id_spec.rb
mongo-2.18.2 spec/mongo/id_spec.rb
mongo-2.17.3 spec/mongo/id_spec.rb
mongo-2.18.1 spec/mongo/id_spec.rb
mongo-2.18.0 spec/mongo/id_spec.rb
mongo-2.17.2 spec/mongo/id_spec.rb
mongo-2.16.3 spec/mongo/id_spec.rb
mongo-2.18.0.beta1 spec/mongo/id_spec.rb
mongo-2.16.2 spec/mongo/id_spec.rb
mongo-2.17.1 spec/mongo/id_spec.rb
mongo-2.16.1 spec/mongo/id_spec.rb
mongo-2.17.0 spec/mongo/id_spec.rb
mongo-2.16.0 spec/mongo/id_spec.rb
mongo-2.15.1 spec/mongo/id_spec.rb
mongo-2.16.0.alpha1 spec/mongo/id_spec.rb
mongo-2.15.0 spec/mongo/id_spec.rb