@@ -275,7 +275,6 @@ def test_show_single_with_fields
275275 assert_response :success
276276 assert json_response [ 'data' ] . is_a? ( Hash )
277277 assert_nil json_response [ 'data' ] [ 'attributes' ]
278- assert_equal '1' , json_response [ 'data' ] [ 'relationships' ] [ 'author' ] [ 'data' ] [ 'id' ]
279278 end
280279
281280 def test_show_single_with_fields_string
@@ -326,7 +325,6 @@ def test_create_simple
326325
327326 assert_response :created
328327 assert json_response [ 'data' ] . is_a? ( Hash )
329- assert_equal '3' , json_response [ 'data' ] [ 'relationships' ] [ 'author' ] [ 'data' ] [ 'id' ]
330328 assert_equal 'JR is Great' , json_response [ 'data' ] [ 'attributes' ] [ 'title' ]
331329 assert_equal 'JSONAPIResources is the greatest thing since unsliced bread.' , json_response [ 'data' ] [ 'attributes' ] [ 'body' ]
332330 end
@@ -431,7 +429,7 @@ def test_create_multiple
431429 assert_response :created
432430 assert json_response [ 'data' ] . is_a? ( Array )
433431 assert_equal json_response [ 'data' ] . size , 2
434- assert_equal json_response [ 'data' ] [ 0 ] [ 'relationships' ] [ 'author' ] [ 'data' ] [ 'id' ] , '3'
432+ assert_nil json_response [ 'data' ] [ 0 ] [ 'relationships' ] [ 'author' ] [ 'data' ]
435433 assert_match /JR is Great/ , response . body
436434 assert_match /Ember is Great/ , response . body
437435 end
@@ -561,7 +559,8 @@ def test_create_with_links_to_many_type_ids
561559 author : { data : { type : 'people' , id : '3' } } ,
562560 tags : { data : [ { type : 'tags' , id : 3 } , { type : 'tags' , id : 4 } ] }
563561 }
564- }
562+ } ,
563+ include : 'author'
565564 }
566565
567566 assert_response :created
@@ -585,7 +584,8 @@ def test_create_with_links_to_many_array
585584 author : { data : { type : 'people' , id : '3' } } ,
586585 tags : { data : [ { type : 'tags' , id : 3 } , { type : 'tags' , id : 4 } ] }
587586 }
588- }
587+ } ,
588+ include : 'author'
589589 }
590590
591591 assert_response :created
@@ -639,7 +639,7 @@ def test_update_with_links
639639 tags : { data : [ { type : 'tags' , id : 3 } , { type : 'tags' , id : 4 } ] }
640640 }
641641 } ,
642- include : 'tags'
642+ include : 'tags,author,section '
643643 }
644644
645645 assert_response :success
@@ -709,7 +709,7 @@ def test_update_remove_links
709709 tags : [ ]
710710 }
711711 } ,
712- include : 'tags'
712+ include : 'tags,author,section '
713713 }
714714
715715 assert_response :success
@@ -1246,15 +1246,11 @@ def test_update_multiple
12461246
12471247 assert_response :success
12481248 assert_equal json_response [ 'data' ] . size , 2
1249- assert_equal json_response [ 'data' ] [ 0 ] [ 'relationships' ] [ 'author' ] [ 'data' ] [ 'id' ] , '3'
1250- assert_equal json_response [ 'data' ] [ 0 ] [ 'relationships' ] [ 'section' ] [ 'data' ] [ 'id' ] , javascript . id . to_s
12511249 assert_equal json_response [ 'data' ] [ 0 ] [ 'attributes' ] [ 'title' ] , 'A great new Post QWERTY'
12521250 assert_equal json_response [ 'data' ] [ 0 ] [ 'attributes' ] [ 'body' ] , 'AAAA'
12531251 assert matches_array? ( [ { 'type' => 'tags' , 'id' => '3' } , { 'type' => 'tags' , 'id' => '4' } ] ,
12541252 json_response [ 'data' ] [ 0 ] [ 'relationships' ] [ 'tags' ] [ 'data' ] )
12551253
1256- assert_equal json_response [ 'data' ] [ 1 ] [ 'relationships' ] [ 'author' ] [ 'data' ] [ 'id' ] , '3'
1257- assert_equal json_response [ 'data' ] [ 1 ] [ 'relationships' ] [ 'section' ] [ 'data' ] [ 'id' ] , javascript . id . to_s
12581254 assert_equal json_response [ 'data' ] [ 1 ] [ 'attributes' ] [ 'title' ] , 'A great new Post ASDFG'
12591255 assert_equal json_response [ 'data' ] [ 1 ] [ 'attributes' ] [ 'body' ] , 'Not First!!!!'
12601256 assert matches_array? ( [ { 'type' => 'tags' , 'id' => '3' } , { 'type' => 'tags' , 'id' => '4' } ] ,
@@ -1601,7 +1597,7 @@ def test_create_expense_entries_underscored
16011597 iso_currency : { data : { type : 'iso_currencies' , id : 'USD' } }
16021598 }
16031599 } ,
1604- include : 'iso_currency' ,
1600+ include : 'iso_currency,employee ' ,
16051601 fields : { expense_entries : 'id,transaction_date,iso_currency,cost,employee' }
16061602 }
16071603
@@ -1632,7 +1628,7 @@ def test_create_expense_entries_camelized_key
16321628 isoCurrency : { data : { type : 'iso_currencies' , id : 'USD' } }
16331629 }
16341630 } ,
1635- include : 'isoCurrency' ,
1631+ include : 'isoCurrency,employee ' ,
16361632 fields : { expenseEntries : 'id,transactionDate,isoCurrency,cost,employee' }
16371633 }
16381634
@@ -1663,7 +1659,7 @@ def test_create_expense_entries_dasherized_key
16631659 'iso-currency' => { data : { type : 'iso_currencies' , id : 'USD' } }
16641660 }
16651661 } ,
1666- include : 'iso-currency' ,
1662+ include : 'iso-currency,employee ' ,
16671663 fields : { 'expense-entries' => 'id,transaction-date,iso-currency,cost,employee' }
16681664 }
16691665
@@ -1948,18 +1944,13 @@ def test_get_related_resource
19481944 links : {
19491945 self : 'http://test.host/people/1/relationships/preferences' ,
19501946 related : 'http://test.host/people/1/preferences'
1951- } ,
1952- data : {
1953- type : 'preferences' ,
1954- id : '1'
19551947 }
19561948 } ,
19571949 "hair-cut" => {
19581950 "links" => {
19591951 "self" => "http://test.host/people/1/relationships/hair_cut" ,
19601952 "related" => "http://test.host/people/1/hair_cut"
1961- } ,
1962- "data" => nil
1953+ }
19631954 } ,
19641955 vehicles : {
19651956 links : {
@@ -2160,7 +2151,6 @@ def test_create_simple_namespaced
21602151
21612152 assert_response :created
21622153 assert json_response [ 'data' ] . is_a? ( Hash )
2163- assert_equal '3' , json_response [ 'data' ] [ 'relationships' ] [ 'writer' ] [ 'data' ] [ 'id' ]
21642154 assert_equal 'JR - now with Namespacing' , json_response [ 'data' ] [ 'attributes' ] [ 'title' ]
21652155 assert_equal 'JSONAPIResources is the greatest thing since unsliced bread now that it has namespaced resources.' ,
21662156 json_response [ 'data' ] [ 'attributes' ] [ 'body' ]
0 commit comments