test/spec_mock.rb in rack-1.3.10 vs test/spec_mock.rb in rack-1.4.0
- old
+ new
@@ -40,11 +40,11 @@
env["SCRIPT_NAME"].should.equal ""
env["rack.url_scheme"].should.equal "http"
env["mock.postdata"].should.be.empty
end
- should "allow GET/POST/PUT/DELETE" do
+ should "allow GET/POST/PUT/DELETE/HEAD" do
res = Rack::MockRequest.new(app).get("", :input => "foo")
env = YAML.load(res.body)
env["REQUEST_METHOD"].should.equal "GET"
res = Rack::MockRequest.new(app).post("", :input => "foo")
@@ -57,10 +57,14 @@
res = Rack::MockRequest.new(app).delete("", :input => "foo")
env = YAML.load(res.body)
env["REQUEST_METHOD"].should.equal "DELETE"
+ res = Rack::MockRequest.new(app).head("", :input => "foo")
+ env = YAML.load(res.body)
+ env["REQUEST_METHOD"].should.equal "HEAD"
+
Rack::MockRequest.env_for("/", :method => "OPTIONS")["REQUEST_METHOD"].
should.equal "OPTIONS"
end
should "set content length" do
@@ -187,10 +191,10 @@
end
should "call close on the original body object" do
called = false
body = Rack::BodyProxy.new(['hi']) { called = true }
- capp = proc { |e| [200, {'Content-Type' => 'text/plain '}, body] }
+ capp = proc { |e| [200, {'Content-Type' => 'text/plain'}, body] }
called.should.equal false
Rack::MockRequest.new(capp).get('/', :lint => true)
called.should.equal true
end
end