spec: fix multipart form builder StringIO filename in 1.8

In 1.8 StringIO responds to path but returns nil, so it was using a different
filename. That wasn't harmful, but was inconsistent (and made the spec
fail in 1.8).

Change-Id: Ifdc37c47b4cab3a5834cd71e48453658c21c4083
Reviewed-on: https://gerrit.instructure.com/17724
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2013-02-14 10:26:36 -07:00
parent 6380d4d5b8
commit 32122840f7
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ module Multipart
def file_param(k, v)
file_data = v.read rescue nil
if file_data
file_path = v.respond_to?(:path) ? v.path : k.to_s
file_path = (v.respond_to?(:path) && v.path) || k.to_s
FileParam.new(k, file_path, file_data)
else
Param.new(k,v)