aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/secure_random_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/secure_random_test.rb')
-rw-r--r--activesupport/test/core_ext/secure_random_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/secure_random_test.rb b/activesupport/test/core_ext/secure_random_test.rb
new file mode 100644
index 0000000000..dfacb7fe9f
--- /dev/null
+++ b/activesupport/test/core_ext/secure_random_test.rb
@@ -0,0 +1,20 @@
+require 'abstract_unit'
+require 'active_support/core_ext/securerandom'
+
+class SecureRandomTest < ActiveSupport::TestCase
+ def test_base58
+ s1 = SecureRandom.base58
+ s2 = SecureRandom.base58
+
+ assert_not_equal s1, s2
+ assert_equal 16, s1.length
+ end
+
+ def test_base58_with_length
+ s1 = SecureRandom.base58(24)
+ s2 = SecureRandom.base58(24)
+
+ assert_not_equal s1, s2
+ assert_equal 24, s1.length
+ end
+end