Skip to content

Commit cfd6cee

Browse files
committed
Changing expectations where ::Hash was testing equal to ActionController::Parameters, now deprecated
1 parent 05aacaf commit cfd6cee

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

spec/controllers/hyrax/admin/stats_controller_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
expect(response).to be_successful
2828
expect(assigns[:presenter]).to be_kind_of Hyrax::AdminStatsPresenter
2929
expect(assigns[:presenter])
30-
.to have_attributes(limit: 5, stats_filters: {})
30+
.to have_attributes(limit: 5, stats_filters: ActionController::Parameters.new({}))
3131
end
3232

3333
context 'with a custom presenter' do
@@ -40,7 +40,7 @@
4040

4141
expect(assigns[:presenter]).to be_kind_of presenter_class
4242
expect(assigns[:presenter])
43-
.to have_attributes(limit: 5, stats_filters: {})
43+
.to have_attributes(limit: 5, stats_filters: ActionController::Parameters.new({}))
4444
end
4545
end
4646

spec/forms/hyrax/forms/failed_submission_form_wrapper_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434
expect(wrapper.title).to eq(input_params.fetch(:title))
3535
expect(wrapper[:title]).to eq(input_params.fetch(:title))
3636

37-
expect(wrapper.member_of_collections_attributes).to eq(input_params.fetch(:member_of_collections_attributes))
38-
expect(wrapper[:member_of_collections_attributes]).to eq(input_params.fetch(:member_of_collections_attributes))
37+
# Params come back from wrapper as ActionController::Parameters in a regular hash, so we have to do the same to input_params
38+
params_hash = {}
39+
input_params.fetch("member_of_collections_attributes").each_pair do |nested_key, nested_value|
40+
params_hash[nested_key] = nested_value
41+
end
42+
expect(wrapper.member_of_collections_attributes).to eq(params_hash)
43+
expect(wrapper[:member_of_collections_attributes]).to eq(params_hash)
3944

4045
expect { wrapper.obviously_missing_attribute }.to raise_error(NoMethodError)
4146
end

0 commit comments

Comments
 (0)