Add have_http_link_header
matcher and set header values as strings (#31010)
This commit is contained in:
parent
09017dd8f0
commit
7efe0bde9d
10 changed files with 54 additions and 39 deletions
|
@ -54,17 +54,12 @@ RSpec.describe AccountControllerConcern do
|
|||
it 'Prepares the account, returns success, and sets link headers' do
|
||||
get 'success', params: { account_username: account.username }
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.headers['Link'].to_s).to eq(expected_link_headers)
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
.and have_http_link_header('http://test.host/.well-known/webfinger?resource=acct%3Ausername%40cb6e6126.ngrok.io').for(rel: 'lrdd', type: 'application/jrd+json')
|
||||
.and have_http_link_header('https://cb6e6126.ngrok.io/users/username').for(rel: 'alternate', type: 'application/activity+json')
|
||||
expect(response.body)
|
||||
.to include(account.username)
|
||||
end
|
||||
|
||||
def expected_link_headers
|
||||
[
|
||||
'<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"',
|
||||
].join(', ')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue