Revision 1f206274
Added by Dominic Cleal over 7 years ago
test/controllers/locations_controller_test.rb | ||
---|---|---|
location = taxonomies(:location2)
|
||
location.update_attributes(:organization_ids => [taxonomies(:organization2).id])
|
||
saved_location = Location.find_by_id(location.id)
|
||
assert_equal saved_location.organization_ids.count, 1
|
||
put :update, { :id => location.id, :location => {:organization_ids => []}}, set_session_user
|
||
assert_equal 1, saved_location.organization_ids.count
|
||
put :update, { :id => location.id, :location => {:organization_ids => [""]}}, set_session_user
|
||
updated_location = Location.find_by_id(location.id)
|
||
assert_equal updated_location.organization_ids.count, 0
|
||
assert_equal 0, updated_location.organization_ids.count
|
||
end
|
||
|
||
context 'wizard' do
|
Also available in: Unified diff
fixes #18155 - add string to empty form-encoded arrays in test
This test attempts to send an empty `:smart_proxy_ids => []` parameter
emulating the UI to unset smart_proxy_ids on a taxonomy, but Rails 5
filters this empty parameter out when converting it internally to a form
encoded parameter (since it's not possible to specify an empty array in
a form) for the purposes of the test.
Comparing the test to the real UI shows that it really submits
`:smart_proxy_ids => [""]` to pass an empty array, so update the test
data to match.