Autofix Rubocop Rails/ResponseParsedBody (#24051)

lolsob-rspec
Nick Schonning 2023-04-26 11:25:07 -04:00 committed by GitHub
parent 75ec0f4951
commit 28d554cc49
4 changed files with 3 additions and 12 deletions

View File

@ -1489,15 +1489,6 @@ Rails/RakeEnvironment:
- 'lib/tasks/repo.rake' - 'lib/tasks/repo.rake'
- 'lib/tasks/statistics.rake' - 'lib/tasks/statistics.rake'
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Include.
# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb
Rails/ResponseParsedBody:
Exclude:
- 'spec/controllers/follower_accounts_controller_spec.rb'
- 'spec/controllers/following_accounts_controller_spec.rb'
- 'spec/controllers/settings/two_factor_authentication/webauthn_credentials_controller_spec.rb'
# Configuration parameters: Include. # Configuration parameters: Include.
# Include: db/**/*.rb # Include: db/**/*.rb
Rails/ReversibleMigration: Rails/ReversibleMigration:

View File

@ -41,7 +41,7 @@ describe FollowerAccountsController do
context 'when format is json' do context 'when format is json' do
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
subject(:body) { JSON.parse(response.body) } subject(:body) { response.parsed_body }
context 'with page' do context 'with page' do
let(:page) { 1 } let(:page) { 1 }

View File

@ -41,7 +41,7 @@ describe FollowingAccountsController do
context 'when format is json' do context 'when format is json' do
subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } } subject(:response) { get :index, params: { account_username: alice.username, page: page, format: :json } }
subject(:body) { JSON.parse(response.body) } subject(:body) { response.parsed_body }
context 'with page' do context 'with page' do
let(:page) { 1 } let(:page) { 1 }

View File

@ -140,7 +140,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
it 'includes existing credentials in list of excluded credentials' do it 'includes existing credentials in list of excluded credentials' do
get :options get :options
excluded_credentials_ids = JSON.parse(response.body)['excludeCredentials'].pluck('id') excluded_credentials_ids = response.parsed_body['excludeCredentials'].pluck('id')
expect(excluded_credentials_ids).to match_array(user.webauthn_credentials.pluck(:external_id)) expect(excluded_credentials_ids).to match_array(user.webauthn_credentials.pluck(:external_id))
end end
end end