aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/store_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-05-30 13:06:05 -0700
committerSean Griffin <sean@thoughtbot.com>2014-06-01 10:55:23 -0600
commit93734629a33591486b76e3b9884ea37650934eef (patch)
treedd4dd281a5db237c7e67ac01f1bfc0bbb725f98b /activerecord/test/cases/store_test.rb
parenta70b9ba62ed323347fe76be47afd80ee60729d9b (diff)
downloadrails-93734629a33591486b76e3b9884ea37650934eef.tar.gz
rails-93734629a33591486b76e3b9884ea37650934eef.tar.bz2
rails-93734629a33591486b76e3b9884ea37650934eef.zip
Don't change values in `@raw_attributes` during serialization
During `init_with`, the attributes given to the coder will be placed into `@raw_attributes`. As such, we should read from `@raw_attributes` when encoding, rather than `@attributes`, which has been type cast.
Diffstat (limited to 'activerecord/test/cases/store_test.rb')
-rw-r--r--activerecord/test/cases/store_test.rb14
1 files changed, 0 insertions, 14 deletions
diff --git a/activerecord/test/cases/store_test.rb b/activerecord/test/cases/store_test.rb
index 6a34c55011..f841b1c983 100644
--- a/activerecord/test/cases/store_test.rb
+++ b/activerecord/test/cases/store_test.rb
@@ -183,20 +183,6 @@ class StoreTest < ActiveRecord::TestCase
assert_equal({}, @john.params)
end
- test "attributes_for_coder should return stored fields already serialized" do
- attributes = {
- "id" => @john.id,
- "name"=> @john.name,
- "settings" => "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncolor: black\n",
- "preferences" => "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\nremember_login: true\n",
- "json_data" => "{\"height\":\"tall\"}", "json_data_empty"=>"{\"is_a_good_guy\":true}",
- "params" => "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess {}\n",
- "account_id"=> @john.account_id
- }
-
- assert_equal attributes, @john.attributes_for_coder
- end
-
test "dump, load and dump again a model" do
dumped = YAML.dump(@john)
loaded = YAML.load(dumped)