diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-01 14:25:33 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-01 14:25:47 -0800 |
commit | a0fac7192241f3242af410ca16e6dd43b933c98e (patch) | |
tree | 2bc99ef839dfc2fda1328b8eabc4c5d4c2306f7a /activerecord/test/cases/base_test.rb | |
parent | ebe485fd8ec80a1a9b86516bc6f74bc5bbba3476 (diff) | |
download | rails-a0fac7192241f3242af410ca16e6dd43b933c98e.tar.gz rails-a0fac7192241f3242af410ca16e6dd43b933c98e.tar.bz2 rails-a0fac7192241f3242af410ca16e6dd43b933c98e.zip |
store the serialized column values in the @attributes hash
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 7c677d55ca..5cbc52732b 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1037,6 +1037,31 @@ class BasicsTest < ActiveRecord::TestCase assert topic.save topic = topic.reload assert_equal [s].pack('m'), topic.content + ensure + Topic.serialize(:content) + end + + def test_serialize_with_bcrypt_coder + crypt_coder = Class.new { + def load(thing) + return unless thing + BCrypt::Password.new thing + end + + def dump(thing) + BCrypt::Password.create(thing).to_s + end + }.new + + Topic.serialize(:content, crypt_coder) + password = 'password' + topic = Topic.new(:content => password) + assert topic.save + topic = topic.reload + assert_kind_of BCrypt::Password, topic.content + assert_equal(true, topic.content == password, 'password should equal') + ensure + Topic.serialize(:content) end def test_quote |