Use expect
for nested params in more controllers (#33675)
This commit is contained in:
parent
2a6a418f48
commit
d2cc28813f
8 changed files with 71 additions and 6 deletions
18
spec/requests/disputes/appeals_spec.rb
Normal file
18
spec/requests/disputes/appeals_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Disputes Appeals' do
|
||||
describe 'POST /disputes/appeals' do
|
||||
before { sign_in strike.target_account.user }
|
||||
|
||||
let(:strike) { Fabricate :account_warning }
|
||||
|
||||
it 'gracefully handles invalid nested params' do
|
||||
post disputes_strike_appeal_path(strike, appeal: 'invalid')
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,4 +13,28 @@ RSpec.describe 'Filters' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /filters' do
|
||||
before { sign_in Fabricate :user }
|
||||
|
||||
it 'gracefully handles invalid nested params' do
|
||||
post filters_path(custom_filter: 'invalid')
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT /filters/:id' do
|
||||
before { sign_in(filter.account.user) }
|
||||
|
||||
let(:filter) { Fabricate :custom_filter }
|
||||
|
||||
it 'gracefully handles invalid nested params' do
|
||||
put filter_path(filter, custom_filter: 'invalid')
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,4 +28,13 @@ RSpec.describe 'Invites' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /invites' do
|
||||
it 'gracefully handles invalid nested params' do
|
||||
post invites_path(invite: 'invalid')
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
16
spec/requests/statuses_cleanup_spec.rb
Normal file
16
spec/requests/statuses_cleanup_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Statuses Cleanup' do
|
||||
describe 'PUT /statuses_cleanup' do
|
||||
before { sign_in Fabricate(:user) }
|
||||
|
||||
it 'gracefully handles invalid nested params' do
|
||||
put statuses_cleanup_path(account_statuses_cleanup_policy: 'invalid')
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(400)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue