0
0
Fork 0

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
This commit is contained in:
Matt Jankowski 2017-06-10 03:39:26 -04:00 committed by Eugen Rochko
parent 778430b54a
commit 2925372ff4
10 changed files with 341 additions and 198 deletions

View file

@ -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