Rack::Test::UploadedFile is a permitted scalar

This commit is contained in:
Fabio Kreusch 2013-02-21 11:00:26 -03:00
parent b0fa9b59c8
commit fa9ec0a678
2 changed files with 6 additions and 4 deletions

@ -191,9 +191,9 @@ def require(key)
#
# +:name+ passes it is a key of +params+ whose associated value is of type
# +String+, +Symbol+, +NilClass+, +Numeric+, +TrueClass+, +FalseClass+,
# +Date+, +Time+, +DateTime+, +StringIO+, +IO+, or
# +ActionDispatch::Http::UploadedFile+. Otherwise, the key +:name+ is
# filtered out.
# +Date+, +Time+, +DateTime+, +StringIO+, +IO+,
# +ActionDispatch::Http::UploadedFile+ or +Rack::Test::UploadedFile+.
# Otherwise, the key +:name+ is filtered out.
#
# You may declare that the parameter should be an array of permitted scalars
# by mapping it to an empty array:
@ -374,6 +374,7 @@ def unpermitted_keys(params)
StringIO,
IO,
ActionDispatch::Http::UploadedFile,
Rack::Test::UploadedFile,
]
def permitted_scalar?(value)

@ -32,7 +32,8 @@ def assert_filtered_out(params, key)
values += [0, 1.0, 2**128, BigDecimal.new(1)]
values += [true, false]
values += [Date.today, Time.now, DateTime.now]
values += [STDOUT, StringIO.new, ActionDispatch::Http::UploadedFile.new(tempfile: __FILE__)]
values += [STDOUT, StringIO.new, ActionDispatch::Http::UploadedFile.new(tempfile: __FILE__),
Rack::Test::UploadedFile.new(__FILE__)]
values.each do |value|
params = ActionController::Parameters.new(id: value)