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 50e5ac6
Showing 1 changed file with 7 additions and 2 deletions.
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 50e5ac6

Please sign in to comment.