Sha256: 7d03a3fbd00ead8d3b5a0e7f84ba8c80709c32fcfb7eaccb4e71e9f155758a9d
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
require 'test/spec' require 'rack/mock' require 'rack/methodoverride' require 'stringio' context "Rack::MethodOverride" do specify "should not affect GET requests" do env = Rack::MockRequest.env_for("/?_method=delete", :method => "GET") app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) }) req = app.call(env) req.env["REQUEST_METHOD"].should.equal "GET" end specify "should modify REQUEST_METHOD for POST requests" do env = Rack::MockRequest.env_for("/", :method => "POST", :input => "_method=put") app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) }) req = app.call(env) req.env["REQUEST_METHOD"].should.equal "PUT" end specify "should not modify REQUEST_METHOD if the method is unknown" do env = Rack::MockRequest.env_for("/", :method => "POST", :input => "_method=foo") app = Rack::MethodOverride.new(lambda { |env| Rack::Request.new(env) }) req = app.call(env) req.env["REQUEST_METHOD"].should.equal "POST" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kastner-rack-0.3.171 | test/spec_rack_methodoverride.rb |
kastner-rack-0.3.186 | test/spec_rack_methodoverride.rb |