Skip to content

Commit

Permalink
spec checking wether Marshal.dump(params) is possible
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Sep 1, 2010
1 parent ba0d18a commit 38ad411
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.