mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Account for different handling of symbol keys in Rails 4.0
Comparing as a JSON string vs. as the Hash that is convert to JSON
works around the different Hash representations.
This likely has to do with the introduction of
config.action_dispatch.perform_deep_munge in Rails 4.1
See Rails issue 13420
1) Failure:
ActiveModel::Serializer::Adapter::Json::HasManyTestTest#test_has_many_with_no_serializer
[active_model_serializers/test/adapter/json/has_many_test.rb:36]:
--- expected
+++ actual
@@ -1 +1 @@
-{:id=>42, :tags=>[{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}]}
+{:id=>42, :tags=>[{"attributes"=>{:id=>1, :name=>"#hash_tag"}}]}
2) Failure:
ActiveModel::Serializer::AssociationsTest#test_has_many_with_no_serializer
[active_model_serializers/test/serializers/associations_test.rb:74]:
--- expected
+++ actual
@@ -1 +1 @@
-[{"attributes"=>{"name"=>"#hashtagged"}}]
+[{"attributes"=>{:name=>"#hashtagged"}}]
This commit is contained in:
parent
741c4a4b51
commit
17d560eae4
@ -38,7 +38,7 @@ module ActiveModel
|
||||
tags: [
|
||||
{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}
|
||||
]
|
||||
}, adapter.serializable_hash[:post_with_tags])
|
||||
}.to_json, adapter.serializable_hash[:post_with_tags].to_json)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -71,7 +71,7 @@ module ActiveModel
|
||||
PostWithTagsSerializer.new(@post).each_association do |name, serializer, options|
|
||||
assert_equal name, :tags
|
||||
assert_equal serializer, nil
|
||||
assert_equal [{ attributes: { name: "#hashtagged" }}].as_json, options[:virtual_value]
|
||||
assert_equal [{ attributes: { name: "#hashtagged" }}].to_json, options[:virtual_value].to_json
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user