mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Add failing test: serialize array with format_keys w/o root
This commit is contained in:
parent
b9d216debd
commit
c4e6cd48b6
@ -210,6 +210,43 @@ module ActionController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class LowerCamelWoRootSerializerTest < ActionController::TestCase
|
||||||
|
class WebLogController < ActionController::Base
|
||||||
|
def render_without_root
|
||||||
|
render json: WebLog.new({name: 'Name 1', display_name: 'Display Name 1'}),
|
||||||
|
root: false,
|
||||||
|
serializer: WebLogLowerCamelSerializer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tests WebLogController
|
||||||
|
|
||||||
|
def test_render_without_root
|
||||||
|
get :render_without_root
|
||||||
|
assert_equal 'application/json', @response.content_type
|
||||||
|
assert_equal '{"name":"Name 1","displayName":"Display Name 1"}', @response.body
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class LowerCamelArrayWoRootSerializerTest < ActionController::TestCase
|
||||||
|
class WebLogController < ActionController::Base
|
||||||
|
def render_array_without_root
|
||||||
|
render json: [WebLog.new({name: 'Name 1', display_name: 'Display Name 1'}),
|
||||||
|
WebLog.new({name: 'Name 2', display_name: 'Display Name 2'})],
|
||||||
|
root: false,
|
||||||
|
each_serializer: WebLogLowerCamelSerializer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tests WebLogController
|
||||||
|
|
||||||
|
def test_render_array_without_root
|
||||||
|
get :render_array_without_root
|
||||||
|
assert_equal 'application/json', @response.content_type
|
||||||
|
assert_equal '[{"name":"Name 1","displayName":"Display Name 1"},{"name":"Name 2","displayName":"Display Name 2"}]', @response.body
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class ArrayEmbedingSerializerTest < ActionController::TestCase
|
class ArrayEmbedingSerializerTest < ActionController::TestCase
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user