Skip to content

Commit 91ffec4

Browse files
committed
Add test for ArraySerializer json_key method
test json key when resource is empty
1 parent 7faa5e8 commit 91ffec4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/array_serializer_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ def test_meta_and_meta_key_attr_readers
3838
assert_equal @serializer.meta, "the meta"
3939
assert_equal @serializer.meta_key, "the meta key"
4040
end
41+
42+
def test_json_key_when_resource_is_empty
43+
Array.class_eval do
44+
def name
45+
'PostComment'
46+
end
47+
end
48+
@post_comments = []
49+
@serializer = ArraySerializer.new(@post_comments)
50+
assert_equal @serializer.json_key, "post_comments"
51+
end
4152
end
4253
end
4354
end

0 commit comments

Comments
 (0)