@@ -36,7 +36,7 @@ def test_each_object_should_be_serialized_with_appropriate_serializer
36
36
assert_kind_of PostSerializer , serializers . last
37
37
assert_kind_of Post , serializers . last . object
38
38
39
- assert_equal serializers . last . custom_options [ :some ] , :options
39
+ assert_equal :options , serializers . last . custom_options [ :some ]
40
40
end
41
41
42
42
def test_serializer_option_not_passed_to_each_serializer
@@ -47,50 +47,50 @@ def test_serializer_option_not_passed_to_each_serializer
47
47
48
48
def test_root_default
49
49
@serializer = collection_serializer . new ( [ @comment , @post ] )
50
- assert_equal @serializer . root , nil
50
+ assert_nil @serializer . root
51
51
end
52
52
53
53
def test_root
54
54
expected = 'custom_root'
55
55
@serializer = collection_serializer . new ( [ @comment , @post ] , root : expected )
56
- assert_equal @serializer . root , expected
56
+ assert_equal expected , @serializer . root
57
57
end
58
58
59
59
def test_root_with_no_serializers
60
60
expected = 'custom_root'
61
61
@serializer = collection_serializer . new ( [ ] , root : expected )
62
- assert_equal @serializer . root , expected
62
+ assert_equal expected , @serializer . root
63
63
end
64
64
65
65
def test_json_key
66
- assert_equal @serializer . json_key , 'comments'
66
+ assert_equal 'comments' , @serializer . json_key
67
67
end
68
68
69
69
def test_json_key_with_resource_with_name_and_no_serializers
70
70
serializer = collection_serializer . new ( build_named_collection )
71
- assert_equal serializer . json_key , 'me_resources'
71
+ assert_equal 'me_resources' , serializer . json_key
72
72
end
73
73
74
74
def test_json_key_with_resource_with_nil_name_and_no_serializers
75
75
resource = [ ]
76
76
resource . define_singleton_method ( :name ) { nil }
77
77
serializer = collection_serializer . new ( resource )
78
- assert_equal serializer . json_key , nil
78
+ assert_nil serializer . json_key
79
79
end
80
80
81
81
def test_json_key_with_resource_without_name_and_no_serializers
82
82
serializer = collection_serializer . new ( [ ] )
83
- assert_equal serializer . json_key , nil
83
+ assert_nil serializer . json_key
84
84
end
85
85
86
86
def test_json_key_with_root
87
87
serializer = collection_serializer . new ( @resource , root : 'custom_root' )
88
- assert_equal serializer . json_key , 'custom_roots'
88
+ assert_equal 'custom_roots' , serializer . json_key
89
89
end
90
90
91
91
def test_json_key_with_root_and_no_serializers
92
92
serializer = collection_serializer . new ( build_named_collection , root : 'custom_root' )
93
- assert_equal serializer . json_key , 'custom_roots'
93
+ assert_equal 'custom_roots' , serializer . json_key
94
94
end
95
95
end
96
96
end
0 commit comments