Refactor controllers for statuses, accounts, and more (#11249)
This commit is contained in:
parent
f14776475d
commit
63c7fe8e48
41 changed files with 299 additions and 289 deletions
|
@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do
|
|||
it 'sets link headers' do
|
||||
account = Fabricate(:account, username: 'username', user: Fabricate(:user))
|
||||
get 'success', params: { account_username: 'username' }
|
||||
expect(response.headers['Link'].to_s).to eq '<http://test.host/.well-known/webfinger?resource=acct%3Ausername%40cb6e6126.ngrok.io>; rel="lrdd"; type="application/xrd+xml", <http://test.host/users/username.atom>; rel="alternate"; type="application/atom+xml", <https://cb6e6126.ngrok.io/users/username>; rel="alternate"; type="application/activity+json"'
|
||||
expect(response.headers['Link'].to_s).to eq '<http://test.host/.well-known/webfinger?resource=acct%3Ausername%40cb6e6126.ngrok.io>; rel="lrdd"; type="application/jrd+json", <https://cb6e6126.ngrok.io/users/username>; rel="alternate"; type="application/activity+json"'
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
|
|
|
@ -92,7 +92,7 @@ describe StatusesController do
|
|||
end
|
||||
|
||||
it 'assigns @max_descendant_thread_id for the last thread if it is hitting the status limit' do
|
||||
stub_const 'StatusesController::DESCENDANTS_LIMIT', 1
|
||||
stub_const 'StatusControllerConcern::DESCENDANTS_LIMIT', 1
|
||||
status = Fabricate(:status)
|
||||
child = Fabricate(:status, in_reply_to_id: status.id)
|
||||
|
||||
|
@ -103,7 +103,7 @@ describe StatusesController do
|
|||
end
|
||||
|
||||
it 'assigns @descendant_threads for threads with :next_status key if they are hitting the depth limit' do
|
||||
stub_const 'StatusesController::DESCENDANTS_DEPTH_LIMIT', 2
|
||||
stub_const 'StatusControllerConcern::DESCENDANTS_DEPTH_LIMIT', 2
|
||||
status = Fabricate(:status)
|
||||
child0 = Fabricate(:status, in_reply_to_id: status.id)
|
||||
child1 = Fabricate(:status, in_reply_to_id: child0.id)
|
||||
|
|
|
@ -11,16 +11,16 @@ describe 'Link headers' do
|
|||
end
|
||||
|
||||
it 'contains webfinger url in link header' do
|
||||
link_header = link_header_with_type('application/xrd+xml')
|
||||
link_header = link_header_with_type('application/jrd+json')
|
||||
|
||||
expect(link_header.href).to match 'http://www.example.com/.well-known/webfinger?resource=acct%3Atest%40cb6e6126.ngrok.io'
|
||||
expect(link_header.attr_pairs.first).to eq %w(rel lrdd)
|
||||
end
|
||||
|
||||
it 'contains atom url in link header' do
|
||||
link_header = link_header_with_type('application/atom+xml')
|
||||
it 'contains activitypub url in link header' do
|
||||
link_header = link_header_with_type('application/activity+json')
|
||||
|
||||
expect(link_header.href).to eq 'http://www.example.com/users/test.atom'
|
||||
expect(link_header.href).to eq 'https://cb6e6126.ngrok.io/users/test'
|
||||
expect(link_header.attr_pairs.first).to eq %w(rel alternate)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue