aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2015-01-09 17:51:23 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2015-01-09 17:51:46 -0500
commitb1093977110f18ae0cafe56c3d99fc22a7d54d1b (patch)
tree08c688fd107285d218eae5256fffcdffdb3620b1 /activesupport/test/core_ext
parent82dd93bd5eb6613c6fd8ba0725b30c273aba7008 (diff)
downloadrails-b1093977110f18ae0cafe56c3d99fc22a7d54d1b.tar.gz
rails-b1093977110f18ae0cafe56c3d99fc22a7d54d1b.tar.bz2
rails-b1093977110f18ae0cafe56c3d99fc22a7d54d1b.zip
Add SecureRandom.base58
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/securerandom.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/securerandom.rb b/activesupport/test/core_ext/securerandom.rb
new file mode 100644
index 0000000000..dfacb7fe9f
--- /dev/null
+++ b/activesupport/test/core_ext/securerandom.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