Add response.content_type
checks for JSON to api/v1
request specs (#31981)
This commit is contained in:
parent
a7dbf6f5a5
commit
66326065b0
98 changed files with 930 additions and 14 deletions
|
@ -61,6 +61,8 @@ RSpec.describe 'Account actions' do
|
|||
it 'disables the target account' do
|
||||
expect { subject }.to change { target_account.reload.user_disabled? }.from(false).to(true)
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,6 +77,8 @@ RSpec.describe 'Account actions' do
|
|||
it 'marks the target account as sensitive' do
|
||||
expect { subject }.to change { target_account.reload.sensitized? }.from(false).to(true)
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -89,6 +93,8 @@ RSpec.describe 'Account actions' do
|
|||
it 'marks the target account as silenced' do
|
||||
expect { subject }.to change { target_account.reload.silenced? }.from(false).to(true)
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -103,6 +109,8 @@ RSpec.describe 'Account actions' do
|
|||
it 'marks the target account as suspended' do
|
||||
expect { subject }.to change { target_account.reload.suspended? }.from(false).to(true)
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -115,6 +123,8 @@ RSpec.describe 'Account actions' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,6 +135,8 @@ RSpec.describe 'Account actions' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -135,6 +147,8 @@ RSpec.describe 'Account actions' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,8 @@ RSpec.describe 'Accounts' 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_results.map { |a| a.id.to_s })
|
||||
end
|
||||
end
|
||||
|
@ -93,6 +95,8 @@ RSpec.describe 'Accounts' 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
|
||||
end
|
||||
|
@ -112,6 +116,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: account.id.to_s, username: account.username, email: account.user.email)
|
||||
)
|
||||
|
@ -122,6 +128,8 @@ RSpec.describe 'Accounts' do
|
|||
get '/api/v1/admin/accounts/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -145,6 +153,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(account.reload.user_approved?).to be(true)
|
||||
end
|
||||
|
||||
|
@ -166,6 +176,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -174,6 +186,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/approve', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -197,6 +211,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(User.where(id: account.user.id)).to_not exist
|
||||
|
||||
expect(latest_admin_action_log)
|
||||
|
@ -214,6 +230,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -222,6 +240,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/reject', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -244,6 +264,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(account.reload.user_disabled?).to be false
|
||||
end
|
||||
|
||||
|
@ -252,6 +274,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/enable', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -275,6 +299,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(account.reload.suspended?).to be false
|
||||
end
|
||||
end
|
||||
|
@ -284,6 +310,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -292,6 +320,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/unsuspend', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -314,6 +344,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(account.reload.sensitized?).to be false
|
||||
end
|
||||
|
||||
|
@ -322,6 +354,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/unsensitive', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -344,6 +378,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(account.reload.silenced?).to be false
|
||||
end
|
||||
|
||||
|
@ -352,6 +388,8 @@ RSpec.describe 'Accounts' do
|
|||
post '/api/v1/admin/accounts/-1/unsilence', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -376,6 +414,8 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(Admin::AccountDeletionWorker).to have_received(:perform_async).with(account.id).once
|
||||
end
|
||||
end
|
||||
|
@ -393,6 +433,8 @@ RSpec.describe 'Accounts' do
|
|||
delete '/api/v1/admin/accounts/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no canonical email block' do
|
||||
|
@ -96,6 +98,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
id: eq(canonical_email_block.id.to_s),
|
||||
|
@ -109,6 +113,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
get '/api/v1/admin/canonical_email_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -131,6 +137,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(400)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -142,6 +150,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body.first[:canonical_email_hash]).to eq(canonical_email_block.canonical_email_hash)
|
||||
end
|
||||
end
|
||||
|
@ -151,6 +161,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to be_empty
|
||||
end
|
||||
end
|
||||
|
@ -173,6 +185,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:canonical_email_hash]).to eq(canonical_email_block.canonical_email_hash)
|
||||
end
|
||||
|
||||
|
@ -183,6 +197,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -193,6 +209,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:canonical_email_hash]).to eq(params[:canonical_email_hash])
|
||||
end
|
||||
end
|
||||
|
@ -204,6 +222,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:canonical_email_hash]).to eq(canonical_email_block.canonical_email_hash)
|
||||
end
|
||||
end
|
||||
|
@ -217,6 +237,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -237,6 +259,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(CanonicalEmailBlock.find_by(id: canonical_email_block.id)).to be_nil
|
||||
end
|
||||
|
||||
|
@ -245,6 +269,8 @@ RSpec.describe 'Canonical Email Blocks' do
|
|||
delete '/api/v1/admin/canonical_email_blocks/0', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,6 +15,8 @@ RSpec.describe 'Admin Dimensions' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,6 +29,9 @@ RSpec.describe 'Admin Dimensions' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Array)
|
||||
end
|
||||
|
|
|
@ -24,6 +24,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no allowed domains' do
|
||||
|
@ -79,6 +81,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:domain]).to eq domain_allow.domain
|
||||
end
|
||||
|
||||
|
@ -87,6 +91,8 @@ RSpec.describe 'Domain Allows' do
|
|||
get '/api/v1/admin/domain_allows/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -107,6 +113,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:domain]).to eq 'foo.bar.com'
|
||||
expect(DomainAllow.find_by(domain: 'foo.bar.com')).to be_present
|
||||
end
|
||||
|
@ -119,6 +127,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -129,6 +139,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -160,6 +172,8 @@ RSpec.describe 'Domain Allows' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(DomainAllow.find_by(id: domain_allow.id)).to be_nil
|
||||
end
|
||||
|
||||
|
@ -168,6 +182,8 @@ RSpec.describe 'Domain Allows' do
|
|||
delete '/api/v1/admin/domain_allows/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no domain blocks' do
|
||||
|
@ -94,6 +96,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match(
|
||||
id: domain_block.id.to_s,
|
||||
domain: domain_block.domain,
|
||||
|
@ -113,6 +117,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
get '/api/v1/admin/domain_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -132,6 +138,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match a_hash_including(
|
||||
{
|
||||
domain: 'foo.bar.com',
|
||||
|
@ -153,6 +161,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match a_hash_including(
|
||||
{
|
||||
domain: 'foo.bar.com',
|
||||
|
@ -173,6 +183,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:existing_domain_block][:domain]).to eq('foo.bar.com')
|
||||
end
|
||||
end
|
||||
|
@ -186,6 +198,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:existing_domain_block][:domain]).to eq('bar.com')
|
||||
end
|
||||
end
|
||||
|
@ -197,6 +211,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -217,6 +233,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match a_hash_including(
|
||||
{
|
||||
id: domain_block.id.to_s,
|
||||
|
@ -236,6 +254,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
put '/api/v1/admin/domain_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -255,6 +275,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(DomainBlock.find_by(id: domain_block.id)).to be_nil
|
||||
end
|
||||
|
||||
|
@ -263,6 +285,8 @@ RSpec.describe 'Domain Blocks' do
|
|||
delete '/api/v1/admin/domain_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,6 +25,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no email domain block' do
|
||||
|
@ -97,6 +99,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:domain]).to eq(email_domain_block.domain)
|
||||
end
|
||||
end
|
||||
|
@ -106,6 +110,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
get '/api/v1/admin/email_domain_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -125,6 +131,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body[:domain]).to eq(params[:domain])
|
||||
end
|
||||
|
||||
|
@ -135,6 +143,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,6 +155,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -157,6 +169,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -176,6 +190,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(EmailDomainBlock.find_by(id: email_domain_block.id)).to be_nil
|
||||
end
|
||||
|
@ -185,6 +201,8 @@ RSpec.describe 'Email Domain Blocks' do
|
|||
delete '/api/v1/admin/email_domain_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there is no ip block' do
|
||||
|
@ -88,6 +90,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
|
@ -101,6 +105,8 @@ RSpec.describe 'IP Blocks' do
|
|||
get '/api/v1/admin/ip_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -120,6 +126,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body)
|
||||
.to include(
|
||||
ip: eq("#{params[:ip]}/32"),
|
||||
|
@ -135,6 +143,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,6 +155,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -157,6 +169,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -167,6 +181,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -185,6 +201,8 @@ RSpec.describe 'IP Blocks' do
|
|||
.and change_comment_value
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match(hash_including({
|
||||
ip: "#{ip_block.ip}/#{ip_block.ip.prefix}",
|
||||
severity: 'sign_up_requires_approval',
|
||||
|
@ -205,6 +223,8 @@ RSpec.describe 'IP Blocks' do
|
|||
put '/api/v1/admin/ip_blocks/-1', headers: headers, params: params
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -220,6 +240,8 @@ RSpec.describe 'IP Blocks' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to be_empty
|
||||
expect(IpBlock.find_by(id: ip_block.id)).to be_nil
|
||||
end
|
||||
|
@ -229,6 +251,8 @@ RSpec.describe 'IP Blocks' do
|
|||
delete '/api/v1/admin/ip_blocks/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,8 @@ RSpec.describe 'Admin Measures' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,6 +45,8 @@ RSpec.describe 'Admin Measures' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Array)
|
||||
|
|
|
@ -23,6 +23,8 @@ RSpec.describe 'Reports' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no reports' do
|
||||
|
@ -126,6 +128,8 @@ RSpec.describe 'Reports' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to include(
|
||||
{
|
||||
id: report.id.to_s,
|
||||
|
@ -156,6 +160,8 @@ RSpec.describe 'Reports' do
|
|||
.and create_an_action_log
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
report.reload
|
||||
|
||||
|
@ -190,6 +196,8 @@ RSpec.describe 'Reports' do
|
|||
.to change { report.reload.unresolved? }.from(true).to(false)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -208,6 +216,8 @@ RSpec.describe 'Reports' do
|
|||
.to change { report.reload.unresolved? }.from(false).to(true)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -226,6 +236,8 @@ RSpec.describe 'Reports' do
|
|||
.to change { report.reload.assigned_account_id }.from(nil).to(user.account.id)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -244,6 +256,8 @@ RSpec.describe 'Reports' do
|
|||
.to change { report.reload.assigned_account_id }.from(user.account.id).to(nil)
|
||||
.and create_an_action_log
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ RSpec.describe 'Admin Retention' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,6 +28,8 @@ RSpec.describe 'Admin Retention' do
|
|||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body)
|
||||
.to be_an(Array)
|
||||
|
|
|
@ -24,6 +24,8 @@ RSpec.describe 'Tags' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
context 'when there are no tags' do
|
||||
|
@ -77,6 +79,8 @@ RSpec.describe 'Tags' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body[:id].to_i).to eq(tag.id)
|
||||
expect(response.parsed_body[:name]).to eq(tag.name)
|
||||
|
@ -87,6 +91,8 @@ RSpec.describe 'Tags' do
|
|||
get '/api/v1/admin/tags/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -107,6 +113,8 @@ RSpec.describe 'Tags' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
|
||||
expect(response.parsed_body[:id].to_i).to eq(tag.id)
|
||||
expect(response.parsed_body[:name]).to eq(tag.name.upcase)
|
||||
|
@ -119,6 +127,8 @@ RSpec.describe 'Tags' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,6 +137,8 @@ RSpec.describe 'Tags' do
|
|||
get '/api/v1/admin/tags/-1', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,6 +38,8 @@ RSpec.describe 'Links' do
|
|||
.to change_link_trendable_to_true
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expects_correct_link_data
|
||||
end
|
||||
|
||||
|
@ -60,6 +64,8 @@ RSpec.describe 'Links' do
|
|||
post '/api/v1/admin/trends/links/-1/approve', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -70,6 +76,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -89,6 +97,8 @@ RSpec.describe 'Links' do
|
|||
.to_not change_link_trendable
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
|
||||
def change_link_trendable
|
||||
|
@ -114,6 +124,8 @@ RSpec.describe 'Links' do
|
|||
post '/api/v1/admin/trends/links/-1/reject', headers: headers
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -124,6 +136,8 @@ RSpec.describe 'Links' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ RSpec.describe 'API V1 Admin Trends Links Preview Card Providers' do
|
|||
get '/api/v1/admin/trends/links/publishers', params: { account_id: account.id, limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,6 +31,8 @@ RSpec.describe 'API V1 Admin Trends Links Preview Card Providers' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,6 +46,8 @@ RSpec.describe 'API V1 Admin Trends Links Preview Card Providers' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ RSpec.describe 'API V1 Admin Trends Statuses' do
|
|||
get '/api/v1/admin/trends/statuses', params: { account_id: account.id, limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,6 +31,8 @@ RSpec.describe 'API V1 Admin Trends Statuses' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,6 +46,8 @@ RSpec.describe 'API V1 Admin Trends Statuses' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ RSpec.describe 'API V1 Admin Trends Tags' do
|
|||
get '/api/v1/admin/trends/tags', params: { account_id: account.id, limit: 2 }, headers: headers
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,6 +31,8 @@ RSpec.describe 'API V1 Admin Trends Tags' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,6 +46,8 @@ RSpec.describe 'API V1 Admin Trends Tags' do
|
|||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue