aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorHongli Lai (Phusion <hongli@phusion.nl>2008-08-27 12:42:08 +0200
committerMichael Koziarski <michael@koziarski.com>2008-08-27 15:08:16 +0200
commitb3411ff59eb1e1c31f98f58f117a2ffaaf0c3ff5 (patch)
treec0bacd1a0ffa73149ce3eb81b5ef6a345093147d /activesupport/test
parent9dbde4f5cbd0617ee6cce3e41d41335f9c9ce3fd (diff)
downloadrails-b3411ff59eb1e1c31f98f58f117a2ffaaf0c3ff5.tar.gz
rails-b3411ff59eb1e1c31f98f58f117a2ffaaf0c3ff5.tar.bz2
rails-b3411ff59eb1e1c31f98f58f117a2ffaaf0c3ff5.zip
Deprecate Rails::SecretKeyGenerator in favor of ActiveSupport::SecureRandom.
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]
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/secure_random_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/secure_random_test.rb b/activesupport/test/secure_random_test.rb
new file mode 100644
index 0000000000..b0b6c21a81
--- /dev/null
+++ b/activesupport/test/secure_random_test.rb
@@ -0,0 +1,15 @@
+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