Merbでファイルアップロードのspecを書く場合には、
multipart_
1 tmp = Tempfile.new('spec') 2 path = tmp.path + ".txt" 3 begin 4 file = open(path, "w+") 5 file.write "test" 6 multipart_post(resource(:materials), 7 :material => {:id => nil, :label => 'test', :file => file}) 8 tmp.close 9 ensure 10 file.close 11 File.unlink path 12 end
:content_t
posted by
genki
on Thu 26 Feb 2009
at 00:59