2017-06-10 09:39:26 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-31 20:27:17 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 07:12:25 +02:00
|
|
|
RSpec.describe 'API routes' do
|
2017-05-31 21:36:24 +02:00
|
|
|
describe 'Credentials routes' do
|
|
|
|
it 'routes to verify credentials' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/verify_credentials'))
|
|
|
|
.to route_to('api/v1/accounts/credentials#show')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to update credentials' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(patch('/api/v1/accounts/update_credentials'))
|
|
|
|
.to route_to('api/v1/accounts/credentials#update')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Account routes' do
|
|
|
|
it 'routes to statuses' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/user/statuses'))
|
|
|
|
.to route_to('api/v1/accounts/statuses#index', account_id: 'user')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to followers' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/user/followers'))
|
|
|
|
.to route_to('api/v1/accounts/follower_accounts#index', account_id: 'user')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to following' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/user/following'))
|
|
|
|
.to route_to('api/v1/accounts/following_accounts#index', account_id: 'user')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to search' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/search'))
|
|
|
|
.to route_to('api/v1/accounts/search#show')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to relationships' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/accounts/relationships'))
|
|
|
|
.to route_to('api/v1/accounts/relationships#index')
|
2017-05-31 21:36:24 +02:00
|
|
|
end
|
|
|
|
end
|
2017-06-09 20:12:40 +02:00
|
|
|
|
|
|
|
describe 'Statuses routes' do
|
|
|
|
it 'routes reblogged_by' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/statuses/123/reblogged_by'))
|
|
|
|
.to route_to('api/v1/statuses/reblogged_by_accounts#index', status_id: '123')
|
2017-06-09 20:12:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes favourited_by' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/statuses/123/favourited_by'))
|
|
|
|
.to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123')
|
2017-06-09 20:12:40 +02:00
|
|
|
end
|
2017-06-10 09:39:26 +02:00
|
|
|
|
|
|
|
it 'routes reblog' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/reblog'))
|
|
|
|
.to route_to('api/v1/statuses/reblogs#create', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes unreblog' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/unreblog'))
|
|
|
|
.to route_to('api/v1/statuses/reblogs#destroy', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes favourite' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/favourite'))
|
|
|
|
.to route_to('api/v1/statuses/favourites#create', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes unfavourite' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/unfavourite'))
|
|
|
|
.to route_to('api/v1/statuses/favourites#destroy', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes mute' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/mute'))
|
|
|
|
.to route_to('api/v1/statuses/mutes#create', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes unmute' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(post('/api/v1/statuses/123/unmute'))
|
|
|
|
.to route_to('api/v1/statuses/mutes#destroy', status_id: '123')
|
2017-06-10 09:39:26 +02:00
|
|
|
end
|
2017-06-09 20:12:40 +02:00
|
|
|
end
|
|
|
|
|
2017-05-31 20:27:17 +02:00
|
|
|
describe 'Timeline routes' do
|
|
|
|
it 'routes to home timeline' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/timelines/home'))
|
|
|
|
.to route_to('api/v1/timelines/home#show')
|
2017-05-31 20:27:17 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to public timeline' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/timelines/public'))
|
|
|
|
.to route_to('api/v1/timelines/public#show')
|
2017-05-31 20:27:17 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'routes to tag timeline' do
|
2023-02-17 22:56:20 +01:00
|
|
|
expect(get('/api/v1/timelines/tag/test'))
|
|
|
|
.to route_to('api/v1/timelines/tag#show', id: 'test')
|
2017-05-31 20:27:17 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|