Sha256: 3624eb21a4eab9fec409903e908fe50498b99adf4459dcd973028be68c2f4c37

Contents?: true

Size: 651 Bytes

Versions: 8

Compression:

Stored size: 651 Bytes

Contents

require File.expand_path("../../spec_helper.rb", __FILE__)

describe SecureRandom do
  it "should correctly obtain random bits" do
    bits = []
    1000.times do
      bits << SecureRandom.random_bytes(16)
    end
    # Check to make sure that none of the 10,000 strings were duplicates
    expect((bits.map {|x| x.to_s}).uniq.size).to eql(bits.size)
  end

  it "should return the correct number of random bits" do
    expect(SecureRandom.random_bytes(16).size).to eql(16)
    expect(SecureRandom.random_bytes(6).size).to eql(6)
  end

  it "should return a sane random number" do
    expect(SecureRandom.random_number(5000)).to be < 5000
  end
end

Version data entries

8 entries across 8 versions & 5 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/uuidtools-2.2.0/spec/uuidtools/utility_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/uuidtools-2.2.0/spec/uuidtools/utility_spec.rb
uuidtools-2.2.0 spec/uuidtools/utility_spec.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb
uuidtools-2.1.5 spec/uuidtools/utility_spec.rb