Skip to content

Commit

Permalink
Changing expectations where ::Hash was testing equal to ActionControl…
Browse files Browse the repository at this point in the history
…ler::Parameters, now deprecated
  • Loading branch information
randalldfloyd committed Dec 13, 2024
1 parent 05aacaf commit cfd6cee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spec/controllers/hyrax/admin/stats_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
9 changes: 7 additions & 2 deletions spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfd6cee

Please sign in to comment.