sr (owner)

Revisions

  • 70c7d2 sr Thu Jun 25 14:09:14 -0700 2009
gist: 136171 Download_button fork
public
Public Clone URL: git://gist.github.com/136171.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
diff --git a/spec/integration/rack/app.rb b/spec/integration/rack/app.rb
index 61ab332..2151717 100644
--- a/spec/integration/rack/app.rb
+++ b/spec/integration/rack/app.rb
@@ -33,6 +33,14 @@ class RackApp < Sinatra::Base
     @email = params[:email]
     erb :hello
   end
+
+ get "/upload" do
+ erb :uploader
+ end
+
+ post "/upload" do
+ params[:file]
+ end
 end
 
 __END__
@@ -71,3 +79,11 @@ __END__
 @@ hello
 <p>Hello, <%= @user %></p>
 <p>Your email is: <%= @email %></p>
+
+@@ uploader
+<form action="/upload" method="post">
+ <label>
+ File <input type="file" name="uploaded_file" />
+ </label>
+ <input type="submit" value="Upload">
+</form>
diff --git a/spec/integration/rack/test/webrat_rack_test.rb b/spec/integration/rack/test/webrat_rack_test.rb
index e3d760d..08876ba 100644
--- a/spec/integration/rack/test/webrat_rack_test.rb
+++ b/spec/integration/rack/test/webrat_rack_test.rb
@@ -42,6 +42,14 @@ class WebratRackTest < Test::Unit::TestCase
     visit "/absolute_redirect"
     assert_contain "spam"
   end
+
+ def test_upload_file
+ visit "/upload"
+ attach_file "File", __FILE__
+ click_button "Upload"
+
+ assert_contain("webrat_rack_test.rb")
+ end
 end
 
 class WebratRackSetupTest < Test::Unit::TestCase