<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/mack/testing/file.rb</filename>
    </added>
    <added>
      <filename>test/fake_application/app/views/tst_another/do_upload.html.erb</filename>
    </added>
    <added>
      <filename>test/fake_application/app/views/tst_another/upload_multiple.html.erb</filename>
    </added>
    <added>
      <filename>test/unit/controller/file_upload_spec.rb</filename>
    </added>
    <added>
      <filename>test/unit/controller/images/homer_brain.jpg</filename>
    </added>
    <added>
      <filename>test/unit/controller/images/homer_brain2.jpg</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -82,10 +82,19 @@ module Mack
       def put(uri, options = {})
         build_response(request.put(uri, build_request_options({:input =&gt; options.to_params})))
       end
-    
+      
+      def build_file(path)
+        return Mack::Testing::FileWrapper.new(path)
+      end
+          
       # Performs a 'post' request for the specified uri.
       def post(uri, options = {})
-        build_response(request.post(uri, build_request_options({:input =&gt; options.to_params})))
+        if options[:multipart]
+          form_input = build_multipart_data(options)
+          build_response(request.post(uri, build_request_options({&quot;CONTENT_TYPE&quot; =&gt; &quot;multipart/form-data, boundary=Mack-boundary&quot;, &quot;CONTENT_LENGTH&quot; =&gt; form_input.size, :input =&gt; form_input})))
+        else
+          build_response(request.post(uri, build_request_options({:input =&gt; options.to_params})))
+        end
       end
     
       # Performs a 'delete' request for the specified uri.
@@ -152,6 +161,28 @@ module Mack
       end
     
       private
+      
+      def build_multipart_data(options)
+        form_input = &quot;&quot;
+        boundary = &quot;--Mack-boundary\r\n&quot;
+        options.each_pair do |k, v|
+          if v.kind_of?(Mack::Testing::FileWrapper)
+            form_input += boundary
+            form_input += &quot;content-disposition: form-data; name=\&quot;#{k}\&quot;; filename=\&quot;#{v.file_name}\&quot;\r\n&quot;
+            form_input += &quot;Content-Type: #{v.mime}\r\n\r\n&quot;
+            form_input += &quot;#{v.content}\r\n&quot;
+          elsif k != :multipart 
+            form_input += boundary
+            form_input += &quot;content-disposition: form-data; name=\&quot;#{k}\&quot;\r\n&quot;
+            form_input += &quot;Content-Type: text/plain\r\n\r\n&quot;
+            form_input += &quot;#{v}\r\n&quot;
+          end
+        end
+        form_input += boundary
+        return form_input
+      end
+      
+      
       def test_cookies
         @test_cookies = {} if @test_cookies.nil?
         @test_cookies</diff>
      <filename>lib/mack/testing/helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,6 +48,19 @@ class TstAnotherController
     render(:text, love_you)
   end
   
+  def do_upload
+    file = request.file(&quot;file0&quot;)
+    @saved_file_name = file.file_name
+    @album = params[:album]
+  end
+  
+  def upload_multiple
+    file = request.file(&quot;file0&quot;)
+    @saved_file1 = file.file_name.dup
+    file = request.file(&quot;file1&quot;)
+    @saved_file2 = file.file_name.dup
+  end
+  
   def regardless_of_string_or_symbol
     x = &quot;&quot;
     x &lt;&lt; &quot;from_string: foo=#{params[&quot;foo&quot;]}\n&quot;</diff>
      <filename>test/fake_application/app/controllers/tst_another_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,8 @@ Mack::Routes.build do |r|
     map.env '/env', :action =&gt; :env
     map.kill_kenny_no_meth &quot;/tst_another/kill_kenny&quot;, :action =&gt; :kill_kenny
     map.kill_kenny_bad &quot;/tst_another/kill_kenny_bad&quot;, :action =&gt; :kill_kenny_bad
+    map.upload_file &quot;/tst_another/do_upload&quot;, :action =&gt; :do_upload
+    map.upload_multiple &quot;/tst_another/upload_multiple&quot;, :action =&gt; :upload_multiple
   end
   
   r.with_options(:controller =&gt; &quot;vtt/view_template&quot;) do |map|</diff>
      <filename>test/fake_application/config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,7 +52,7 @@ describe Mack::Request::UploadedFile do
     File.exists?(File.join(Mack.root, &quot;tmp&quot;, @uploaded_file.file_name)).should == true
     File.exists?(@uploaded_file.temp_file.path).should_not == true
   end
-  
+    
   it &quot;should raise error when destination path is not specified&quot; do
     lambda { @uploaded_file.save }.should raise_error(ArgumentError)
   end</diff>
      <filename>test/unit/controller/uploaded_file_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>43f7ea16ad3d16545bfcbc378d5908ebd3fc03f1</id>
    </parent>
    <parent>
      <id>afc26c3570fb97c4509caf7c25ef923d8a46f8d0</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </author>
  <url>http://github.com/markbates/mack/commit/a34c8757220841422dd605fa1a91e87c9b92a530</url>
  <id>a34c8757220841422dd605fa1a91e87c9b92a530</id>
  <committed-date>2008-08-15T15:02:47-07:00</committed-date>
  <authored-date>2008-08-15T15:02:47-07:00</authored-date>
  <message>Merge branch 'master' of git@github.com:markbates/mack into date_selects

* 'master' of git@github.com:markbates/mack:
  Distributed views module now uses file cache [#96]
  file upload testing [#15 state:resolved]
  file upload testing</message>
  <tree>83142e564c867c47f249de7aeab9a8ea2028b3a5</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </committer>
</commit>
