@@ -1648,6 +1648,28 @@ def test_create_validations
16481648 assert_response :success
16491649 end
16501650
1651+ def test_update_link_with_dasherized_type
1652+ JSONAPI . configuration . json_key_format = :dasherized_key
1653+ set_content_type_header!
1654+ put :update ,
1655+ {
1656+ id : 3 ,
1657+ data : {
1658+ id : '3' ,
1659+ type : 'people' ,
1660+ links : {
1661+ 'hair-cut' : {
1662+ linkage : {
1663+ type : 'hair-cuts' ,
1664+ id : '1'
1665+ }
1666+ }
1667+ }
1668+ }
1669+ }
1670+ assert_response :success
1671+ end
1672+
16511673 def test_create_validations_missing_attribute
16521674 set_content_type_header!
16531675 post :create ,
@@ -1705,37 +1727,46 @@ def test_valid_filter_value
17051727 end
17061728
17071729 def test_get_related_resource
1730+ JSONAPI . configuration . json_key_format = :dasherized_key
1731+ JSONAPI . configuration . route_format = :underscored_key
17081732 get :get_related_resource , { post_id : '2' , association : 'author' , :source => 'posts' }
17091733 assert_response :success
1710- assert_hash_equals json_response ,
1711- {
1712- data : {
1713- id : '1' ,
1714- type : 'people' ,
1715- name : 'Joe Author' ,
1716- email : 'joe@xyz.fake' ,
1717- dateJoined : '2013-08-07 16:25:00 -0400' ,
1718- links : {
1719- self : 'http://test.host/people/1' ,
1720- comments : {
1721- self : 'http://test.host/people/1/links/comments' ,
1722- related : 'http://test.host/people/1/comments'
1723- } ,
1724- posts : {
1725- self : 'http://test.host/people/1/links/posts' ,
1726- related : 'http://test.host/people/1/posts'
1727- } ,
1728- preferences : {
1729- self : 'http://test.host/people/1/links/preferences' ,
1730- related : 'http://test.host/people/1/preferences' ,
1731- linkage : {
1732- type : 'preferences' ,
1733- id : '1'
1734- }
1735- }
1736- }
1737- }
1738- }
1734+ assert_hash_equals (
1735+ {
1736+ data : {
1737+ id : '1' ,
1738+ type : 'people' ,
1739+ name : 'Joe Author' ,
1740+ email : 'joe@xyz.fake' ,
1741+ "date-joined" : '2013-08-07 16:25:00 -0400' ,
1742+ links : {
1743+ self : 'http://test.host/people/1' ,
1744+ comments : {
1745+ self : 'http://test.host/people/1/links/comments' ,
1746+ related : 'http://test.host/people/1/comments'
1747+ } ,
1748+ posts : {
1749+ self : 'http://test.host/people/1/links/posts' ,
1750+ related : 'http://test.host/people/1/posts'
1751+ } ,
1752+ preferences : {
1753+ self : 'http://test.host/people/1/links/preferences' ,
1754+ related : 'http://test.host/people/1/preferences' ,
1755+ linkage : {
1756+ type : 'preferences' ,
1757+ id : '1'
1758+ }
1759+ } ,
1760+ "hair-cut" => {
1761+ "self" => "http://test.host/people/1/links/hair_cut" ,
1762+ "related" => "http://test.host/people/1/hair_cut" ,
1763+ "linkage" => nil
1764+ }
1765+ }
1766+ }
1767+ } ,
1768+ json_response
1769+ )
17391770 end
17401771
17411772 def test_get_related_resource_nil
0 commit comments