Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add some more edge-case tests to improve coverage

darcs-hash:20070511145605-4fc50-e3e8e83f7d4bd6fbbbbee59d014dc5b7a549a7a5.gz
  • Loading branch information...
commit 30a35505f77e02e27b90b1eff91c110bff0f30a1 1 parent 68dd1b9
Christian Neukirchen authored
4  lib/rack/mock.rb
@@ -32,6 +32,10 @@ def write(warning)
32 32
 
33 33
       def flush
34 34
       end
  35
+
  36
+      def string
  37
+        ""
  38
+      end
35 39
     end
36 40
 
37 41
     DEFAULT_ENV = {
3  test/spec_rack_camping.rb
... ...
@@ -1,5 +1,6 @@
1 1
 require 'test/spec'
2 2
 require 'stringio'
  3
+require 'uri'
3 4
 
4 5
 require 'rack/mock'
5 6
 
@@ -12,6 +13,7 @@ module CampApp
12 13
   module Controllers
13 14
     class HW < R('/')
14 15
       def get
  16
+        @headers["X-Served-By"] = URI("http://rack.rubyforge.org")
15 17
         "Camping works!"
16 18
       end
17 19
 
@@ -30,6 +32,7 @@ def post
30 32
 
31 33
     res.should.be.ok
32 34
     res["Content-Type"].should.equal "text/html"
  35
+    res["X-Served-By"].should.equal "http://rack.rubyforge.org"
33 36
 
34 37
     res.body.should.equal "Camping works!"
35 38
   end
2  test/spec_rack_mock.rb
@@ -126,6 +126,7 @@
126 126
     res["Content-Type"].should.equal "text/yaml"
127 127
     res.content_type.should.equal "text/yaml"
128 128
     res.content_length.should.be.nil
  129
+    res.location.should.be.nil
129 130
   end
130 131
 
131 132
   specify "should provide access to the HTTP body" do
@@ -133,6 +134,7 @@
133 134
     res.body.should =~ /rack/
134 135
     res.should =~ /rack/
135 136
     res.should.match(/rack/)
  137
+    res.should.satisfy { |r| r.match(/rack/) }
136 138
   end
137 139
 
138 140
   specify "should provide access to the Rack errors" do
12  test/spec_rack_session_cookie.rb
@@ -34,4 +34,16 @@
8  test/spec_rack_urlmap.rb
@@ -17,14 +17,8 @@
17 17
                               { "Content-Type" => "text/plain",
18 18
                                 "X-Position" => "/bar",
19 19
                                 "X-PathInfo" => env["PATH_INFO"],
20  
-                              }, [""]]},
21  
-                           
22  
-                           "/foo/bar" => lambda { |env|
23  
-                             [200,
24  
-                              { "Content-Type" => "text/plain",
25  
-                                "X-Position" => "/foo/bar", 
26  
-                                "X-PathInfo" => env["PATH_INFO"],
27 20
                               }, [""]]}
  21
+                           
28 22
                            )
29 23
 
30 24
     

0 notes on commit 30a3550

Please sign in to comment.
Something went wrong with that request. Please try again.