mastodon/spec/routing/api_routing_spec.rb
Matt Jankowski 5282ba862a Move reblogged_by and favourited_by actions out of api/v1/statuses and into unique controllers (#3646)
* Add specs for api statuses routes

* Update favourited_by and reblogged_by api routes

* Move methods into new controllers

* Use load_accounts methods to simplify index actions

* Clean up load_accounts methods

* Clean up link header generation

* Check for link headers in specs

* Remove unused actions from api/v1/statuses controller

* Remove specs for moved actions
2017-06-09 14:12:40 -04:00

72 lines
2.1 KiB
Ruby

require 'rails_helper'
describe 'API routes' do
describe 'Credentials routes' do
it 'routes to verify credentials' do
expect(get('/api/v1/accounts/verify_credentials')).
to route_to('api/v1/accounts/credentials#show')
end
it 'routes to update credentials' do
expect(patch('/api/v1/accounts/update_credentials')).
to route_to('api/v1/accounts/credentials#update')
end
end
describe 'Account routes' do
it 'routes to statuses' do
expect(get('/api/v1/accounts/user/statuses')).
to route_to('api/v1/accounts/statuses#index', account_id: 'user')
end
it 'routes to followers' do
expect(get('/api/v1/accounts/user/followers')).
to route_to('api/v1/accounts/follower_accounts#index', account_id: 'user')
end
it 'routes to following' do
expect(get('/api/v1/accounts/user/following')).
to route_to('api/v1/accounts/following_accounts#index', account_id: 'user')
end
it 'routes to search' do
expect(get('/api/v1/accounts/search')).
to route_to('api/v1/accounts/search#show')
end
it 'routes to relationships' do
expect(get('/api/v1/accounts/relationships')).
to route_to('api/v1/accounts/relationships#index')
end
end
describe 'Statuses routes' do
it 'routes reblogged_by' do
expect(get('/api/v1/statuses/123/reblogged_by')).
to route_to('api/v1/statuses/reblogged_by_accounts#index', status_id: '123')
end
it 'routes favourited_by' do
expect(get('/api/v1/statuses/123/favourited_by')).
to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123')
end
end
describe 'Timeline routes' do
it 'routes to home timeline' do
expect(get('/api/v1/timelines/home')).
to route_to('api/v1/timelines/home#show')
end
it 'routes to public timeline' do
expect(get('/api/v1/timelines/public')).
to route_to('api/v1/timelines/public#show')
end
it 'routes to tag timeline' do
expect(get('/api/v1/timelines/tag/test')).
to route_to('api/v1/timelines/tag#show', id: 'test')
end
end
end