@@ -10,6 +10,7 @@ def setup
1010 @expense_entry = ExpenseEntry . find ( 1 )
1111
1212 JSONAPI . configuration . json_key_format = :camelized_key
13+ JSONAPI . configuration . route_format = :camelized_route
1314 end
1415
1516 def after_teardown
@@ -1057,26 +1058,29 @@ def test_serializer_array_of_resources_limited_fields
10571058 end
10581059
10591060 def test_serializer_camelized_with_value_formatters
1061+ # JSONAPI.configuration.json_key_format = :camelized_key
1062+ # JSONAPI.configuration.route_format = :camelized_route
1063+
10601064 assert_hash_equals (
10611065 {
10621066 data : {
1063- type : 'expense_entries ' ,
1067+ type : 'expenseEntries ' ,
10641068 id : '1' ,
10651069 transactionDate : '04/15/2014' ,
10661070 cost : 12.05 ,
10671071 links : {
1068- self : '/expense_entries /1' ,
1072+ self : '/expenseEntries /1' ,
10691073 isoCurrency : {
1070- self : '/expense_entries /1/links/iso_currency ' ,
1071- related : '/expense_entries /1/iso_currency ' ,
1074+ self : '/expenseEntries /1/links/isoCurrency ' ,
1075+ related : '/expenseEntries /1/isoCurrency ' ,
10721076 linkage : {
1073- type : 'iso_currencies ' ,
1077+ type : 'isoCurrencies ' ,
10741078 id : 'USD'
10751079 }
10761080 } ,
10771081 employee : {
1078- self : '/expense_entries /1/links/employee' ,
1079- related : '/expense_entries /1/employee' ,
1082+ self : '/expenseEntries /1/links/employee' ,
1083+ related : '/expenseEntries /1/employee' ,
10801084 linkage : {
10811085 type : 'people' ,
10821086 id : '3'
@@ -1086,13 +1090,13 @@ def test_serializer_camelized_with_value_formatters
10861090 } ,
10871091 included : [
10881092 {
1089- type : 'iso_currencies ' ,
1093+ type : 'isoCurrencies ' ,
10901094 id : 'USD' ,
10911095 countryName : 'United States' ,
10921096 name : 'United States Dollar' ,
10931097 minorUnit : 'cent' ,
10941098 links : {
1095- self : '/iso_currencies /USD'
1099+ self : '/isoCurrencies /USD'
10961100 }
10971101 } ,
10981102 {
@@ -1108,7 +1112,7 @@ def test_serializer_camelized_with_value_formatters
11081112 ]
11091113 } ,
11101114 JSONAPI ::ResourceSerializer . new ( ExpenseEntryResource ,
1111- include : [ 'iso_currency ' , 'employee' ] ,
1115+ include : [ 'isoCurrency ' , 'employee' ] ,
11121116 fields : { people : [ :id , :name , :email , :date_joined ] } ) . serialize_to_hash (
11131117 ExpenseEntryResource . new ( @expense_entry ) )
11141118 )
@@ -1128,8 +1132,8 @@ def test_serializer_empty_links_null_and_array
11281132 links : {
11291133 self : '/planets/8' ,
11301134 planetType : {
1131- self : '/planets/8/links/planet_type ' ,
1132- related : '/planets/8/planet_type ' ,
1135+ self : '/planets/8/links/planetType ' ,
1136+ related : '/planets/8/planetType ' ,
11331137 linkage : nil
11341138 } ,
11351139 tags : {
@@ -1165,10 +1169,10 @@ def test_serializer_include_with_empty_links_null_and_array
11651169 links : {
11661170 self : '/planets/7' ,
11671171 planetType : {
1168- self : '/planets/7/links/planet_type ' ,
1169- related : '/planets/7/planet_type ' ,
1172+ self : '/planets/7/links/planetType ' ,
1173+ related : '/planets/7/planetType ' ,
11701174 linkage : {
1171- type : 'planet_types ' ,
1175+ type : 'planetTypes ' ,
11721176 id : '5'
11731177 }
11741178 } ,
@@ -1190,8 +1194,8 @@ def test_serializer_include_with_empty_links_null_and_array
11901194 links : {
11911195 self : '/planets/8' ,
11921196 planetType : {
1193- self : '/planets/8/links/planet_type ' ,
1194- related : '/planets/8/planet_type ' ,
1197+ self : '/planets/8/links/planetType ' ,
1198+ related : '/planets/8/planetType ' ,
11951199 linkage : nil
11961200 } ,
11971201 tags : {
@@ -1207,11 +1211,11 @@ def test_serializer_include_with_empty_links_null_and_array
12071211 ] ,
12081212 included : [
12091213 {
1210- type : 'planet_types ' ,
1214+ type : 'planetTypes ' ,
12111215 id : '5' ,
12121216 name : 'unknown' ,
12131217 links : {
1214- self : '/planet_types /5'
1218+ self : '/planetTypes /5'
12151219 }
12161220 }
12171221 ]
0 commit comments