diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-06-11 16:56:33 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-06-11 16:56:33 -0600 |
commit | cd3f5dba1e1f187179398e1507f8ef8f87c1c23e (patch) | |
tree | 7eebae01976cb17f390a5eec9d1b03d0f7d1a7e3 /activerecord/test/cases/associations_test.rb | |
parent | 850d313c3bd8267ef08c4fdfedbdb510cc419721 (diff) | |
download | rails-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 'activerecord/test/cases/associations_test.rb')
0 files changed, 0 insertions, 0 deletions