From cfd6cee973a5759550512a956ce26fd72e5b9c1d Mon Sep 17 00:00:00 2001 From: Randall Floyd Date: Fri, 13 Dec 2024 14:30:45 -0500 Subject: [PATCH] Changing expectations where ::Hash was testing equal to ActionController::Parameters, now deprecated --- spec/controllers/hyrax/admin/stats_controller_spec.rb | 4 ++-- .../hyrax/forms/failed_submission_form_wrapper_spec.rb | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/spec/controllers/hyrax/admin/stats_controller_spec.rb b/spec/controllers/hyrax/admin/stats_controller_spec.rb index a07225a99b..9dc9f5c782 100644 --- a/spec/controllers/hyrax/admin/stats_controller_spec.rb +++ b/spec/controllers/hyrax/admin/stats_controller_spec.rb @@ -27,7 +27,7 @@ expect(response).to be_successful expect(assigns[:presenter]).to be_kind_of Hyrax::AdminStatsPresenter expect(assigns[:presenter]) - .to have_attributes(limit: 5, stats_filters: {}) + .to have_attributes(limit: 5, stats_filters: ActionController::Parameters.new({})) end context 'with a custom presenter' do @@ -40,7 +40,7 @@ expect(assigns[:presenter]).to be_kind_of presenter_class expect(assigns[:presenter]) - .to have_attributes(limit: 5, stats_filters: {}) + .to have_attributes(limit: 5, stats_filters: ActionController::Parameters.new({})) end end diff --git a/spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb b/spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb index 1f448d2bb9..c57b005403 100644 --- a/spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb +++ b/spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb @@ -34,8 +34,13 @@ expect(wrapper.title).to eq(input_params.fetch(:title)) expect(wrapper[:title]).to eq(input_params.fetch(:title)) - expect(wrapper.member_of_collections_attributes).to eq(input_params.fetch(:member_of_collections_attributes)) - expect(wrapper[:member_of_collections_attributes]).to eq(input_params.fetch(:member_of_collections_attributes)) + # Params come back from wrapper as ActionController::Parameters in a regular hash, so we have to do the same to input_params + params_hash = {} + input_params.fetch("member_of_collections_attributes").each_pair do |nested_key, nested_value| + params_hash[nested_key] = nested_value + end + expect(wrapper.member_of_collections_attributes).to eq(params_hash) + expect(wrapper[:member_of_collections_attributes]).to eq(params_hash) expect { wrapper.obviously_missing_attribute }.to raise_error(NoMethodError) end