aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_securerandom.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_securerandom.rb')
-rw-r--r--test/test_securerandom.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_securerandom.rb b/test/test_securerandom.rb
index 515d05e6b2..cd5cb1dee2 100644
--- a/test/test_securerandom.rb
+++ b/test/test_securerandom.rb
@@ -157,6 +157,20 @@ end
end
end
+ def test_s_random_number_not_default
+ msg = "SecureRandom#random_number should not be affected by srand"
+ seed = srand(0)
+ x = @it.random_number(1000)
+ 10.times do|i|
+ srand(0)
+ return unless @it.random_number(1000) == x
+ end
+ srand(0)
+ assert_not_equal(x, @it.random_number(1000), msg)
+ ensure
+ srand(seed) if seed
+ end
+
def test_uuid
uuid = @it.uuid
assert_equal(36, uuid.size)