assert_routing(
{ :path => "/preferences", :method => :put },
{ :controller => "preferences", :action => "update" }
assert_routing(
{ :path => "/preferences", :method => :put },
{ :controller => "preferences", :action => "update" }
- user.preferred_editor = "unknown"
- put preferences_path, :params => { :user => user.attributes }
+ put preferences_path, :params => { :user => { :preferred_editor => "unknown", :languages => [] } }
assert_select ".alert-success", false
assert_select ".alert-danger", true
assert_select ".alert-success", false
assert_select ".alert-danger", true
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
# Changing to a valid editor should work
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
# Changing to a valid editor should work
- user.preferred_editor = "id"
- put preferences_path, :params => { :user => user.attributes }
+ put preferences_path, :params => { :user => { :preferred_editor => "id", :languages => [] } }
assert_redirected_to preferences_path
follow_redirect!
assert_template :show
assert_select ".alert-success", /^Preferences updated/
assert_redirected_to preferences_path
follow_redirect!
assert_template :show
assert_select ".alert-success", /^Preferences updated/
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
# Changing to the default editor should work
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
# Changing to the default editor should work
- user.preferred_editor = "default"
- put preferences_path, :params => { :user => user.attributes }
+ put preferences_path, :params => { :user => { :preferred_editor => "default", :languages => [] } }
assert_redirected_to preferences_path
follow_redirect!
assert_template :show
assert_select ".alert-success", /^Preferences updated/
assert_redirected_to preferences_path
follow_redirect!
assert_template :show
assert_select ".alert-success", /^Preferences updated/
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
end
assert_equal "light", user.preferences.find_by(:k => "site.color_scheme")&.v
assert_equal "light", user.preferences.find_by(:k => "map.color_scheme")&.v
end