Sha256: d8180ef79dcc9ec824f79a070f2ce00f23ba18475f320cf7c72f1d52d403f50f

Contents?: true

Size: 676 Bytes

Versions: 9

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true
# rubocop:todo all

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

9 entries across 9 versions & 2 rubygems

Version Path
mongo-2.21.0 spec/mongo/id_spec.rb
mongo-2.20.1 spec/mongo/id_spec.rb
mogno-2.20.0 spec/mongo/id_spec.rb
mogno-1.0.0 spec/mongo/id_spec.rb
mongo-2.20.0 spec/mongo/id_spec.rb
mongo-2.19.3 spec/mongo/id_spec.rb
mongo-2.19.2 spec/mongo/id_spec.rb
mongo-2.19.1 spec/mongo/id_spec.rb
mongo-2.19.0 spec/mongo/id_spec.rb