mirror of
https://github.com/github/rails.git
synced 2026-02-15 00:25:00 -05:00
SecureRandom has a few minor security enhancements and can be used as a drop-in replacement Signed-off-by: Michael Koziarski <michael@koziarski.com> [#913 state:committed]
16 lines
381 B
Ruby
16 lines
381 B
Ruby
require 'abstract_unit'
|
|
|
|
class SecureRandomTest < Test::Unit::TestCase
|
|
def test_random_bytes
|
|
b1 = ActiveSupport::SecureRandom.random_bytes(64)
|
|
b2 = ActiveSupport::SecureRandom.random_bytes(64)
|
|
assert_not_equal b1, b2
|
|
end
|
|
|
|
def test_hex
|
|
b1 = ActiveSupport::SecureRandom.hex(64)
|
|
b2 = ActiveSupport::SecureRandom.hex(64)
|
|
assert_not_equal b1, b2
|
|
end
|
|
end
|