diff --git a/spec/routing/admin_panel_routing_spec.rb b/spec/routing/admin_panel_routing_spec.rb index e6ccaa08..913cc31b 100644 --- a/spec/routing/admin_panel_routing_spec.rb +++ b/spec/routing/admin_panel_routing_spec.rb @@ -30,6 +30,54 @@ RSpec.describe 'admin panel routing', :aggregate_failures, type: :routing do ) end + it 'routes comments' do + expect(get: '/admin/comments').to route_to( + controller: 'admin/comments', action: 'index' + ) + expect(get: '/admin/comments/1').to route_to( + controller: 'admin/comments', action: 'show', id: '1' + ) + expect(get: '/admin/comments/new').to route_to( + controller: 'admin/comments', action: 'new' + ) + expect(get: '/admin/comments/1/edit').to route_to( + controller: 'admin/comments', action: 'edit', id: '1' + ) + expect(post: '/admin/comments').to route_to( + controller: 'admin/comments', action: 'create' + ) + expect(patch: '/admin/comments/1').to route_to( + controller: 'admin/comments', action: 'update', id: '1' + ) + expect(delete: '/admin/comments/1').to route_to( + controller: 'admin/comments', action: 'destroy', id: '1' + ) + end + + it 'routes posts' do + expect(get: '/admin/posts').to route_to( + controller: 'admin/posts', action: 'index' + ) + expect(get: '/admin/posts/1').to route_to( + controller: 'admin/posts', action: 'show', id: '1' + ) + expect(get: '/admin/posts/new').to route_to( + controller: 'admin/posts', action: 'new' + ) + expect(get: '/admin/posts/1/edit').to route_to( + controller: 'admin/posts', action: 'edit', id: '1' + ) + expect(post: '/admin/posts').to route_to( + controller: 'admin/posts', action: 'create' + ) + expect(patch: '/admin/posts/1').to route_to( + controller: 'admin/posts', action: 'update', id: '1' + ) + expect(delete: '/admin/posts/1').to route_to( + controller: 'admin/posts', action: 'destroy', id: '1' + ) + end + it 'routes post statuses' do expect(get: '/admin/post_statuses').to route_to( controller: 'admin/post_statuses', action: 'index' diff --git a/spec/routing/boards_routing_spec.rb b/spec/routing/boards_routing_spec.rb index f5a92b3b..193fabbf 100644 --- a/spec/routing/boards_routing_spec.rb +++ b/spec/routing/boards_routing_spec.rb @@ -7,6 +7,9 @@ RSpec.describe 'boards routing', :aggregate_failures, type: :routing do ) expect(get: '/boards').not_to be_routable + expect(get: '/boards/new').not_to route_to( + controller: 'boards', action: 'new' + ) expect(get: '/boards/1/edit').not_to be_routable expect(post: '/boards').not_to be_routable expect(patch: '/boards/1').not_to be_routable diff --git a/spec/routing/comments_routing_spec.rb b/spec/routing/comments_routing_spec.rb new file mode 100644 index 00000000..1f89d302 --- /dev/null +++ b/spec/routing/comments_routing_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +RSpec.describe 'comments routing', :aggregate_failures, type: :routing do + it 'routes comments' do + expect(get: '/posts/1/comments').to route_to( + controller: 'comments', action: 'index', post_id: "1" + ) + expect(post: '/posts/1/comments').to route_to( + controller: 'comments', action: 'create', post_id: "1" + ) + + expect(get: '/posts/1/comments/1').not_to be_routable + expect(get: '/posts/1/comments/new').not_to be_routable + expect(get: '/posts/1/comments/1/edit').not_to be_routable + expect(patch: '/posts/1/comments/1').not_to be_routable + expect(delete: '/posts/1/comments/1').not_to be_routable + end +end \ No newline at end of file diff --git a/spec/routing/post_routing_spec.rb b/spec/routing/post_routing_spec.rb index 14427426..cb591085 100644 --- a/spec/routing/post_routing_spec.rb +++ b/spec/routing/post_routing_spec.rb @@ -15,6 +15,9 @@ RSpec.describe 'posts routing', :aggregate_failures, type: :routing do controller: 'posts', action: 'update', id: '1' ) + expect(get: '/posts/new').not_to route_to( + controller: 'posts', action: 'new' + ) expect(get: '/posts/1/edit').not_to be_routable expect(delete: '/posts/1').not_to be_routable end