Remove body_as_json
in favor of built-in response.parsed_body
for JSON response specs (#31749)
This commit is contained in:
parent
be77a1098b
commit
6b6a80b407
107 changed files with 422 additions and 413 deletions
|
@ -13,7 +13,7 @@ RSpec.describe 'The well-known node-info endpoints' do
|
|||
media_type: 'application/json'
|
||||
)
|
||||
|
||||
expect(body_as_json).to include(
|
||||
expect(response.parsed_body).to include(
|
||||
links: be_an(Array).and(
|
||||
contain_exactly(
|
||||
include(
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe 'The well-known node-info endpoints' do
|
|||
expect(non_matching_hash)
|
||||
.to_not match_json_schema('nodeinfo_2.0')
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to match_json_schema('nodeinfo_2.0')
|
||||
.and include(
|
||||
version: '2.0',
|
||||
|
|
|
@ -21,7 +21,7 @@ RSpec.describe 'The /.well-known/oauth-authorization-server request' do
|
|||
grant_types_supported = Doorkeeper.configuration.grant_flows.dup
|
||||
grant_types_supported << 'refresh_token' if Doorkeeper.configuration.refresh_token_enabled?
|
||||
|
||||
expect(body_as_json).to include(
|
||||
expect(response.parsed_body).to include(
|
||||
issuer: root_url(protocol: protocol),
|
||||
service_documentation: 'https://docs.joinmastodon.org/',
|
||||
authorization_endpoint: oauth_authorization_url(protocol: protocol),
|
||||
|
|
|
@ -24,7 +24,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
|
||||
expect(response.media_type).to eq 'application/jrd+json'
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
subject: eq('acct:alice@cb6e6126.ngrok.io'),
|
||||
aliases: include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice')
|
||||
|
@ -129,7 +129,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
end
|
||||
|
||||
it 'returns links for the internal account' do
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
subject: 'acct:mastodon.internal@cb6e6126.ngrok.io',
|
||||
aliases: ['https://cb6e6126.ngrok.io/actor']
|
||||
|
@ -168,7 +168,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'returns avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(body_as_json)
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to_not be_nil
|
||||
expect(avatar_link[:type]).to eq alice.avatar.content_type
|
||||
expect(avatar_link[:href]).to eq Addressable::URI.new(host: Rails.configuration.x.local_domain, path: alice.avatar.to_s, scheme: 'https').to_s
|
||||
|
@ -182,7 +182,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'does not return avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(body_as_json)
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
end
|
||||
end
|
||||
|
@ -197,7 +197,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
it 'does not return avatar in response' do
|
||||
perform_request!
|
||||
|
||||
avatar_link = get_avatar_link(body_as_json)
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
end
|
||||
end
|
||||
|
@ -212,7 +212,7 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do
|
|||
end
|
||||
|
||||
it 'does not return avatar in response' do
|
||||
avatar_link = get_avatar_link(body_as_json)
|
||||
avatar_link = get_avatar_link(response.parsed_body)
|
||||
expect(avatar_link).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue