1 require File.dirname(__FILE__) + '/../helper'
3 describe "Rack::Request" do
4 it "should return PUT and DELETE based on _method param" do
5 env = {'REQUEST_METHOD' => 'POST', 'rack.input' => StringIO.new('_method=DELETE')}
6 Rack::Request.new(env).request_method.should.equal 'DELETE'
8 env = {'REQUEST_METHOD' => 'POST', 'rack.input' => StringIO.new('_method=PUT')}
9 Rack::Request.new(env).request_method.should.equal 'PUT'
12 it "should not allow faking" do
13 env = {'REQUEST_METHOD' => 'POST', 'rack.input' => StringIO.new('_method=GET')}
14 Rack::Request.new(env).request_method.should.equal 'POST'
16 env = {'REQUEST_METHOD' => 'GET', 'rack.input' => StringIO.new('_method=POST')}
17 Rack::Request.new(env).request_method.should.equal 'GET'