Permalink
Browse files

spec checking wether Marshal.dump(params) is possible

  • Loading branch information...
1 parent ba0d18a commit 38ad411abd901389c1ee28deb6f26ddc8bfb1cac @rkh rkh committed Sep 1, 2010
Showing with 11 additions and 0 deletions.
  1. +11 −0 test/request_test.rb
View
@@ -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

0 comments on commit 38ad411

Please sign in to comment.