Sha256: a3784249656fe1b9523902ccfa834a03940ac320e5200c97c60ddcc789ed6d6a

Contents?: true

Size: 626 Bytes

Versions: 9

Compression:

Stored size: 626 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
    (bits.map {|x| x.to_s}).uniq.size.should == bits.size
  end

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

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

Version data entries

9 entries across 6 versions & 4 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/uuidtools-2.1.4/spec/uuidtools/utility_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/uuidtools-2.1.4/spec/uuidtools/utility_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/uuidtools-2.1.4/spec/uuidtools/utility_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/uuidtools-2.1.4/spec/uuidtools/utility_spec.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/uuidtools-2.1.4/spec/uuidtools/utility_spec.rb
uuidtools-2.1.4 spec/uuidtools/utility_spec.rb
uuidtools-2.1.3 spec/uuidtools/utility_spec.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/uuidtools-2.1.2/spec/uuidtools/utility_spec.rb
uuidtools-2.1.2 spec/uuidtools/utility_spec.rb