aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_help.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-06-11 16:56:33 -0600
committerSean Griffin <sean@thoughtbot.com>2015-06-11 16:56:33 -0600
commitcd3f5dba1e1f187179398e1507f8ef8f87c1c23e (patch)
tree7eebae01976cb17f390a5eec9d1b03d0f7d1a7e3 /railties/lib/rails/test_help.rb
parent850d313c3bd8267ef08c4fdfedbdb510cc419721 (diff)
downloadrails-cd3f5dba1e1f187179398e1507f8ef8f87c1c23e.tar.gz
rails-cd3f5dba1e1f187179398e1507f8ef8f87c1c23e.tar.bz2
rails-cd3f5dba1e1f187179398e1507f8ef8f87c1c23e.zip
Add a missing test case for the persistence behavior of `serialize`
`serialize` makes the contract that if it is given a class name, it will never return something other than an instance of that class. This means that it must cast `nil` to the empty form of that object. As such, we should then persist empty forms of that object as `nil`. While this is techincally under the contract of ``` model.attribute = value assert_equal model.attribute, model.tap(&:save).reload.attribute ``` which we can't actually test universally without property based testing, it has come up more than once and is worth calling out specifically since we aren't looking to change it.
Diffstat (limited to 'railties/lib/rails/test_help.rb')
0 files changed, 0 insertions, 0 deletions