Merge pull request #264 from vad4msiu/features/root_element

Support for setting root element
This commit is contained in:
Steve Klabnik
2013-05-05 12:02:27 -07:00
3 changed files with 20 additions and 1 deletions

View File

@@ -329,6 +329,16 @@ class SerializerTest < ActiveModel::TestCase
assert_equal({ :author => nil }, serializer.new(blog, :scope => user).as_json)
end
def test_true_root
blog = Blog.new
assert_equal({
:blog_with_root => {
:author => nil,
}
}, BlogWithRootSerializer.new(blog).as_json)
end
def test_root_false_on_load_active_model_serializers
begin
ActiveSupport.on_load(:active_model_serializers) do