spec checking wether Marshal.dump(params) is possible

This commit is contained in:
Konstantin Haase 2010-09-01 12:12:36 +02:00
parent ba0d18a8c1
commit 38ad411abd
1 changed files with 11 additions and 0 deletions

View File

@ -30,4 +30,15 @@ class RequestTest < Test::Unit::TestCase
request = Sinatra::Request.new('HTTP_X_FORWARDED_PROTO' => 'https')
assert request.secure?
end
it 'is possible to marshal params' do
request = Sinatra::Request.new(
'REQUEST_METHOD' => 'PUT',
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
'rack.input' => StringIO.new('foo=bar')
)
params = Sinatra::Base.new.send(:indifferent_hash).replace(request.params)
dumped = Marshal.dump(request.params)
assert_equal 'bar', Marshal.load(dumped)['foo']
end
end