Skip to content

Commit

Permalink
change permitted params on verification update action
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-1234 committed Feb 7, 2025
1 parent ab0638a commit 90c03ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/controllers/verifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def update
do_load_resource
do_authorize_instance

if @verification.update(verification_params)
if @verification.update(verification_update_params)
respond_show
else
respond_change_fail
Expand Down Expand Up @@ -88,6 +88,12 @@ def verification_params
)
end

def verification_update_params
params.require(:verification).permit(
:confirmed
)
end

def get_audio_event #rubocop:disable Naming/AccessorMethodName
@audio_event = AudioEvent.find(params[:audio_event_id]) if params&.key?(:audio_event_id)
end
Expand Down
16 changes: 14 additions & 2 deletions spec/api/verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@
model_sent_as_parameter_in_body
response(200, 'successful') do
schema_for_single
auto_send_model
send_model do
{
'verification' => {
confirmed: 'false'
}
}
end
run_test! do
expect_id_matches(verification)
end
Expand All @@ -78,7 +84,13 @@
model_sent_as_parameter_in_body
response(200, 'successful') do
schema_for_single
auto_send_model
send_model do
{
'verification' => {
confirmed: 'false'
}
}
end
run_test! do
expect_id_matches(verification)
end
Expand Down

0 comments on commit 90c03ee

Please sign in to comment.