1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/secure_random_test.rb
Michael Koziarski 1dfebd4f0d 1.8 compatibility for random_number method on SecureRandom.
1.9 has its own version.
2008-10-04 21:11:30 +02:00

19 lines
479 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
def test_random_number
assert ActiveSupport::SecureRandom.random_number(5000) < 5000
end
end