From 2925372ff44347fa7066c380a5d51dd35f80682f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 10 Jun 2017 03:39:26 -0400 Subject: Move create/destroy actions for api/v1/statuses to namespace (#3678) Each of mute, favourite, reblog has been updated to: - Have a separate controller with just a create and destroy action - Preserve historical route names to not break the API - Mild refactoring to break up long methods --- spec/routing/api_routing_spec.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/routing') diff --git a/spec/routing/api_routing_spec.rb b/spec/routing/api_routing_spec.rb index 6c093f19d..2683ccb8d 100644 --- a/spec/routing/api_routing_spec.rb +++ b/spec/routing/api_routing_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe 'API routes' do @@ -50,6 +52,36 @@ describe 'API routes' do expect(get('/api/v1/statuses/123/favourited_by')). to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123') end + + it 'routes reblog' do + expect(post('/api/v1/statuses/123/reblog')). + to route_to('api/v1/statuses/reblogs#create', status_id: '123') + end + + it 'routes unreblog' do + expect(post('/api/v1/statuses/123/unreblog')). + to route_to('api/v1/statuses/reblogs#destroy', status_id: '123') + end + + it 'routes favourite' do + expect(post('/api/v1/statuses/123/favourite')). + to route_to('api/v1/statuses/favourites#create', status_id: '123') + end + + it 'routes unfavourite' do + expect(post('/api/v1/statuses/123/unfavourite')). + to route_to('api/v1/statuses/favourites#destroy', status_id: '123') + end + + it 'routes mute' do + expect(post('/api/v1/statuses/123/mute')). + to route_to('api/v1/statuses/mutes#create', status_id: '123') + end + + it 'routes unmute' do + expect(post('/api/v1/statuses/123/unmute')). + to route_to('api/v1/statuses/mutes#destroy', status_id: '123') + end end describe 'Timeline routes' do -- cgit