test/integration/routes/routes_test.rb in jsonapi-resources-0.2.0 vs test/integration/routes/routes_test.rb in jsonapi-resources-0.3.0.pre1

- old
+ new

@@ -5,12 +5,12 @@ def test_routing_post assert_routing({path: 'posts', method: :post}, {controller: 'posts', action: 'create'}) end - def test_routing_put - assert_routing({path: '/posts/1', method: :put}, + def test_routing_patch + assert_routing({path: '/posts/1', method: :patch}, {controller: 'posts', action: 'update', id: '1'}) end def test_routing_posts_show assert_routing({path: '/posts/1', method: :get}, @@ -26,11 +26,11 @@ assert_routing({path: '/posts/1/links/author', method: :delete}, {controller: 'posts', action: 'destroy_association', post_id: '1', association: 'author'}) end def test_routing_posts_links_author_update - assert_routing({path: '/posts/1/links/author', method: :put}, + assert_routing({path: '/posts/1/links/author', method: :patch}, {controller: 'posts', action: 'update_association', post_id: '1', association: 'author'}) end def test_routing_posts_links_tags_show assert_routing({path: '/posts/1/links/tags', method: :get}, @@ -46,30 +46,14 @@ assert_routing({path: '/posts/1/links/tags', method: :post}, {controller: 'posts', action: 'create_association', post_id: '1', association: 'tags'}) end def test_routing_posts_links_tags_update_acts_as_set - assert_routing({path: '/posts/1/links/tags', method: :put}, + assert_routing({path: '/posts/1/links/tags', method: :patch}, {controller: 'posts', action: 'update_association', post_id: '1', association: 'tags'}) end - def test_routing_authors_show - assert_routing({path: '/authors/1', method: :get}, - {action: 'show', controller: 'authors', id: '1'}) - end - - def test_routing_author_links_posts_create_not_acts_as_set - assert_routing({path: '/authors/1/links/posts', method: :post}, - {controller: 'authors', action: 'create_association', author_id: '1', association: 'posts'}) - end - - # ToDo: Test that non acts as set has_many association update route is not created - # def test_routing_author_links_posts_update_not_acts_as_set - # refute_routing({ path: '/authors/1/links/posts', method: :put }, - # { controller: 'authors', action: 'update_association', author_id: '1', association: 'posts' }) - # end - # V1 def test_routing_v1_posts_show assert_routing({path: '/api/v1/posts/1', method: :get}, {action: 'show', controller: 'api/v1/posts', id: '1'}) end @@ -83,15 +67,10 @@ assert_routing({path: '/api/v1/posts/1/links/writer', method: :get}, {controller: 'api/v1/posts', action: 'show_association', post_id: '1', association: 'writer'}) end # V2 - def test_routing_v2_posts_show - assert_routing({path: '/api/v2/authors/1', method: :get}, - {action: 'show', controller: 'api/v2/authors', id: '1'}) - end - def test_routing_v2_posts_links_author_show assert_routing({path: '/api/v2/posts/1/links/author', method: :get}, {controller: 'api/v2/posts', action: 'show_association', post_id: '1', association: 'author'}) end @@ -140,9 +119,19 @@ assert_routing({path: '/api/v5/expense-entries/1', method: :get}, {action: 'show', controller: 'api/v5/expense_entries', id: '1'}) assert_routing({path: '/api/v5/expense-entries/1/links/iso-currency', method: :get}, {controller: 'api/v5/expense_entries', action: 'show_association', expense_entry_id: '1', association: 'iso_currency'}) + end + + def test_routing_authors_show + assert_routing({path: '/api/v5/authors/1', method: :get}, + {action: 'show', controller: 'api/v5/authors', id: '1'}) + end + + def test_routing_author_links_posts_create_not_acts_as_set + assert_routing({path: '/api/v5/authors/1/links/posts', method: :post}, + {controller: 'api/v5/authors', action: 'create_association', author_id: '1', association: 'posts'}) end #primary_key def test_routing_primary_key_jsonapi_resources assert_routing({path: '/iso_currencies/USD', method: :get},