Project

General

Profile

« Previous | Next » 

Revision 0a54c7f8

Added by Dominic Cleal over 7 years ago

fixes #18665 - call #to_h before comparing AC::Parameters to hash

Allows comparisons when ActionController::Parameters is separated from
Hash in Rails 5.0. #permit! is now called on inner hashes sent through
KeepParam (similar to rails/rails@e86524c in 5.1) so they are included
in the #to_h permitted output.

View differences:

test/controllers/concerns/parameters/host_test.rb
filtered = host_params
assert_equal 'test.example.com', filtered['name']
assert_equal({'foo' => 'bar', 'memory' => 2}, filtered['compute_attributes'])
assert_equal({'foo' => 'bar', 'memory' => 2}, filtered['compute_attributes'].to_h)
assert filtered.permitted?
end
......
assert_equal 'test.example.com', filtered['name']
assert_equal 'abc', filtered['interfaces_attributes'][0][:name]
assert_equal({'type' => 'awesome', 'network' => 'superawesome'}, filtered['interfaces_attributes'][0]['compute_attributes'])
assert_equal({'type' => 'awesome', 'network' => 'superawesome'}, filtered['interfaces_attributes'][0]['compute_attributes'].to_h)
assert filtered.permitted?
end
end

Also available in: Unified diff