diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-21 13:09:48 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-21 13:09:48 -0600 |
commit | 3e422e201de47c6158d2f60679604e51d2539dfb (patch) | |
tree | 7dc0dfe2c8687876e7dd4a4250279d2c502cee65 /activerecord/test | |
parent | 0e9a7059664eb9dee8e3afae60d26ff858d0d84b (diff) | |
download | rails-3e422e201de47c6158d2f60679604e51d2539dfb.tar.gz rails-3e422e201de47c6158d2f60679604e51d2539dfb.tar.bz2 rails-3e422e201de47c6158d2f60679604e51d2539dfb.zip |
Move `attributes` to the `AttributeSet` object.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/attribute_set_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_set_test.rb b/activerecord/test/cases/attribute_set_test.rb index 091f7e396a..e63d278650 100644 --- a/activerecord/test/cases/attribute_set_test.rb +++ b/activerecord/test/cases/attribute_set_test.rb @@ -45,5 +45,13 @@ module ActiveRecord assert clone.frozen? assert_not attributes.frozen? end + + test "to_hash returns a hash of the type cast values" do + builder = AttributeSet::Builder.new(foo: Type::Integer.new, bar: Type::Float.new) + attributes = builder.build_from_database(foo: '1.1', bar: '2.2') + + assert_equal({ foo: 1, bar: 2.2 }, attributes.to_hash) + assert_equal({ foo: 1, bar: 2.2 }, attributes.to_h) + end end end |