rewrite permitted_params_spec

pull/5418/head
Jens Ulferts 8 years ago
parent e07267444e
commit 5b9efd6efe
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 7
      app/models/permitted_params.rb
  2. 1048
      spec/models/permitted_params_spec.rb

@ -101,7 +101,8 @@ class PermittedParams
params.permit(*self.class.permitted_attributes[:group_membership])
end
def new_work_package(args = {})
def update_work_package(args = {})
# used to be called new_work_package with an alias to update_work_package
permitted = permitted_attributes(:new_work_package, args)
permitted_params = params.require(:work_package).permit(*permitted)
@ -185,8 +186,6 @@ class PermittedParams
params.require(:status).permit(*self.class.permitted_attributes[:status])
end
alias :update_work_package :new_work_package
def user
permitted_params = params.require(:user).permit(*self.class.permitted_attributes[:user])
permitted_params = permitted_params.merge(custom_field_values(:user))
@ -427,7 +426,7 @@ class PermittedParams
# only permit values following the schema
# 'id as string' => 'value as string'
values.reject! do |k, v| k.to_i < 1 || !v.is_a?(String) end
values.reject! { |k, v| k.to_i < 1 || !v.is_a?(String) }
values.empty? ? {} : { 'custom_field_values' => values.permit! }
end

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save