Remove double no-records cases in api/v1/admin
req specs (#32014)
This commit is contained in:
parent
66ed7ea4b5
commit
447d0a3e88
7 changed files with 81 additions and 68 deletions
|
@ -20,19 +20,16 @@ RSpec.describe 'Canonical Email Blocks' do
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there is no canonical email block' do
|
||||||
it 'returns an empty list' do
|
it 'returns an empty list' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,7 +40,12 @@ RSpec.describe 'Canonical Email Blocks' do
|
||||||
it 'returns the correct canonical email hashes' do
|
it 'returns the correct canonical email hashes' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body.pluck(:canonical_email_hash)).to match_array(expected_email_hashes)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body.pluck(:canonical_email_hash))
|
||||||
|
.to match_array(expected_email_hashes)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with limit param' do
|
context 'with limit param' do
|
||||||
|
|
|
@ -20,18 +20,14 @@ RSpec.describe 'Domain Allows' do
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there is no allowed domains' do
|
||||||
it 'returns an empty body' do
|
it 'returns an empty body' do
|
||||||
subject
|
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(response.parsed_body).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -51,7 +47,12 @@ RSpec.describe 'Domain Allows' do
|
||||||
it 'returns the correct allowed domains' do
|
it 'returns the correct allowed domains' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to match_array(expected_response)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body)
|
||||||
|
.to match_array(expected_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with limit param' do
|
context 'with limit param' do
|
||||||
|
|
|
@ -20,19 +20,16 @@ RSpec.describe 'Domain Blocks' do
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there are no domain blocks' do
|
||||||
it 'returns an empty list' do
|
it 'returns an empty list' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +63,12 @@ RSpec.describe 'Domain Blocks' do
|
||||||
it 'returns the expected domain blocks' do
|
it 'returns the expected domain blocks' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to match_array(expected_responde)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body)
|
||||||
|
.to match_array(expected_responde)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with limit param' do
|
context 'with limit param' do
|
||||||
|
|
|
@ -21,19 +21,16 @@ RSpec.describe 'Email Domain Blocks' do
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there is no email domain block' do
|
||||||
it 'returns an empty list' do
|
it 'returns an empty list' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,7 +41,12 @@ RSpec.describe 'Email Domain Blocks' do
|
||||||
it 'return the correct blocked email domains' do
|
it 'return the correct blocked email domains' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body.pluck(:domain)).to match_array(blocked_email_domains)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body.pluck(:domain))
|
||||||
|
.to match_array(blocked_email_domains)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with limit param' do
|
context 'with limit param' do
|
||||||
|
|
|
@ -20,19 +20,16 @@ RSpec.describe 'IP Blocks' do
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
it_behaves_like 'forbidden for wrong role', 'Moderator'
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there is no ip block' do
|
||||||
it 'returns an empty body' do
|
it 'returns an empty body' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,7 +57,12 @@ RSpec.describe 'IP Blocks' do
|
||||||
it 'returns the correct blocked ips' do
|
it 'returns the correct blocked ips' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to match_array(expected_response)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body)
|
||||||
|
.to match_array(expected_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with limit param' do
|
context 'with limit param' do
|
||||||
|
|
|
@ -19,19 +19,16 @@ RSpec.describe 'Reports' do
|
||||||
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there are no reports' do
|
||||||
it 'returns an empty list' do
|
it 'returns an empty list' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +63,12 @@ RSpec.describe 'Reports' do
|
||||||
it 'returns all unresolved reports' do
|
it 'returns all unresolved reports' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to match_array(expected_response)
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
|
expect(response.parsed_body)
|
||||||
|
.to match_array(expected_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with resolved param' do
|
context 'with resolved param' do
|
||||||
|
|
|
@ -20,19 +20,16 @@ RSpec.describe 'Tags' do
|
||||||
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
it_behaves_like 'forbidden for wrong scope', 'write:statuses'
|
||||||
it_behaves_like 'forbidden for wrong role', ''
|
it_behaves_like 'forbidden for wrong role', ''
|
||||||
|
|
||||||
it 'returns http success' 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
|
context 'when there are no tags' do
|
||||||
it 'returns an empty list' do
|
it 'returns an empty list' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(response.parsed_body).to be_empty
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,6 +45,11 @@ RSpec.describe 'Tags' do
|
||||||
|
|
||||||
it 'returns the expected tags' do
|
it 'returns the expected tags' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
|
expect(response)
|
||||||
|
.to have_http_status(200)
|
||||||
|
expect(response.content_type)
|
||||||
|
.to start_with('application/json')
|
||||||
tags.each do |tag|
|
tags.each do |tag|
|
||||||
expect(response.parsed_body.find { |item| item[:id] == tag.id.to_s && item[:name] == tag.name }).to_not be_nil
|
expect(response.parsed_body.find { |item| item[:id] == tag.id.to_s && item[:name] == tag.name }).to_not be_nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue