Move `api/v1/timelines/list` to request spec (#28948)
This commit is contained in:
parent
87ad398ddc
commit
0b0ca6f3b8
|
@ -2,20 +2,17 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Api::V1::Timelines::ListController do
|
describe 'API V1 Timelines List' do
|
||||||
render_views
|
|
||||||
|
|
||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
||||||
|
let(:scopes) { 'read:statuses' }
|
||||||
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||||
|
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||||
let(:list) { Fabricate(:list, account: user.account) }
|
let(:list) { Fabricate(:list, account: user.account) }
|
||||||
|
|
||||||
before do
|
|
||||||
allow(controller).to receive(:doorkeeper_token) { token }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with a user context' do
|
context 'with a user context' do
|
||||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:lists') }
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:lists') }
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET /api/v1/timelines/list/:id' do
|
||||||
before do
|
before do
|
||||||
follow = Fabricate(:follow, account: user.account)
|
follow = Fabricate(:follow, account: user.account)
|
||||||
list.accounts << follow.target_account
|
list.accounts << follow.target_account
|
||||||
|
@ -23,7 +20,8 @@ describe Api::V1::Timelines::ListController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +33,8 @@ describe Api::V1::Timelines::ListController do
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'returns http not found' do
|
it 'returns http not found' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(404)
|
expect(response).to have_http_status(404)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,7 +45,7 @@ describe Api::V1::Timelines::ListController do
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'returns http unprocessable entity' do
|
it 'returns http unprocessable entity' do
|
||||||
get :show, params: { id: list.id }
|
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||||
|
|
||||||
expect(response).to have_http_status(422)
|
expect(response).to have_http_status(422)
|
||||||
expect(response.headers['Link']).to be_nil
|
expect(response.headers['Link']).to be_nil
|
Loading…
Reference in New Issue