Merge remote-tracking branch 'parent/main' into upstream-20240926
This commit is contained in:
commit
c905714459
517 changed files with 4284 additions and 3891 deletions
|
@ -31,14 +31,12 @@ RSpec.describe 'Home', :inline_jobs do
|
|||
PostStatusService.new.call(ana, text: 'New toot from ana.')
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
it 'returns http success and statuses of followed users' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns the statuses of followed users' do
|
||||
subject
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body.pluck(:id)).to match_array(home_statuses.map { |status| status.id.to_s })
|
||||
end
|
||||
|
@ -46,20 +44,18 @@ RSpec.describe 'Home', :inline_jobs do
|
|||
context 'with limit param' do
|
||||
let(:params) { { limit: 1 } }
|
||||
|
||||
it 'returns only the requested number of statuses' do
|
||||
it 'returns only the requested number of statuses with pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body.size).to eq(params[:limit])
|
||||
end
|
||||
|
||||
it 'sets the correct pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to include_pagination_headers(
|
||||
prev: api_v1_timelines_home_url(limit: params[:limit], min_id: ana.statuses.first.id),
|
||||
next: api_v1_timelines_home_url(limit: params[:limit], max_id: ana.statuses.first.id)
|
||||
)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -75,6 +71,8 @@ RSpec.describe 'Home', :inline_jobs do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(206)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,6 +83,8 @@ RSpec.describe 'Home', :inline_jobs do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(401)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -97,6 +97,8 @@ RSpec.describe 'Home', :inline_jobs do
|
|||
expect(response)
|
||||
.to have_http_status(422)
|
||||
.and not_have_http_link_header
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.pluck(:id)).to match_array(expected_statuses.map { |status| status.id.to_s })
|
||||
end
|
||||
end
|
||||
|
@ -50,6 +52,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,6 +66,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,6 +80,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -91,6 +99,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -101,6 +111,8 @@ RSpec.describe 'Link' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -123,15 +135,13 @@ RSpec.describe 'Link' do
|
|||
context 'with limit param' do
|
||||
let(:params) { { limit: 1, url: url } }
|
||||
|
||||
it 'returns only the requested number of statuses', :aggregate_failures do
|
||||
it 'returns only the requested number of statuses with pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.size).to eq(params[:limit])
|
||||
end
|
||||
|
||||
it 'sets the correct pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to include_pagination_headers(
|
||||
|
|
|
@ -23,6 +23,8 @@ RSpec.describe 'API V1 Timelines List' do
|
|||
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,6 +38,8 @@ RSpec.describe 'API V1 Timelines List' do
|
|||
get "/api/v1/timelines/list/#{list.id}", headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ RSpec.describe 'Public' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.pluck(:id)).to match_array(expected_statuses.map { |status| status.id.to_s })
|
||||
end
|
||||
end
|
||||
|
@ -100,15 +102,13 @@ RSpec.describe 'Public' do
|
|||
context 'with limit param' do
|
||||
let(:params) { { limit: 1 } }
|
||||
|
||||
it 'returns only the requested number of statuses', :aggregate_failures do
|
||||
it 'returns only the requested number of statuses and sets pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.size).to eq(params[:limit])
|
||||
end
|
||||
|
||||
it 'sets the correct pagination headers', :aggregate_failures do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to include_pagination_headers(
|
||||
|
@ -133,6 +133,8 @@ RSpec.describe 'Public' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -143,6 +145,8 @@ RSpec.describe 'Public' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ RSpec.describe 'Tag' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.pluck(:id))
|
||||
.to match_array(expected_statuses.map { |status| status.id.to_s })
|
||||
.and not_include(private_status.id)
|
||||
|
@ -81,6 +83,8 @@ RSpec.describe 'Tag' do
|
|||
prev: api_v1_timelines_tag_url(limit: params[:limit], min_id: love_status.id),
|
||||
next: api_v1_timelines_tag_url(limit: params[:limit], max_id: love_status.id)
|
||||
)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -107,6 +111,8 @@ RSpec.describe 'Tag' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue