Posting within an integration test with RoR 2

When I am posting from within an Integration test, at /usr/lib/ruby/gems/1.8/actionpack-2.0.2/lib/action_controller:parse_formatted_request_parameters, I get the an exception (listed below) at line 374:

<code>    362 def parse_formatted_request_parameters    363 return {} if content_length.zero?    364    365 content_type, boundary = self.class.extract_multipart_boundary(content_type_with_parameter s)    366    367 # Don't parse params for unknown requests.    368 return {} if content_type.blank?    369    370 mime_type = Mime::Type.lookup(content_type)    371 strategy = ActionController::Base.param_parsers[mime_type]    372    373 # Only multipart form parsing expects a stream. => 374 body = (strategy && strategy != :multipart_form) ? raw_post : self.body    375    376 case strategy    377 when Proc    378 strategy.call(body)    379 when :url_encoded_form    380 self.class.clean_up_ajax_request_body! body    381 self.class.parse_query_parameters(body)    382 when :multipart_form    383 self.class.parse_multipart_form_parameters(body, boundary, content_length, env)    384 when :xml_simple, :xml_node    385 body.blank? ? {} : Hash.from_xml(body).with_indifferent_access    386 when :yaml    387 YAML.load(body)    388 else    389 {}    390 end    391 rescue Exception => e # YAML, XML or Ruby code block errors    392 raise    393 { "body" => body,    394 "content_type" => content_type_with_parameters,    395 "content_length" => content_length,    396 "exception" => "#{e.message} (#{e.class})",    397 "backtrace" => e.backtrace }    398 end </code>

where the raw_post() is in the ternary is defined as: <code>    277 def raw_post    278 unless env.include? 'RAW_POST_DATA' => 279 env['RAW_POST_DATA'] = body.read(content_length)    280 body.rewind if body.respond_to?(:rewind)    281 end    282 env['RAW_POST_DATA']    283 end </code>

Line 279 raises with an ArgumentError: 1 for 0 where the partial trace is:

"/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request.rb:279:in `read'", "/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request.rb:279:in `raw_post'", "/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request.rb:374:in `parse_formatted_request_parameters'", "/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:78:in `request_parameters'", "/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request.rb:287:in `parameters'",

the body method is actually defined in /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:

<code>    65 def body    66 if raw_post = env['RAW_POST_DATA']    67 StringIO.new(raw_post)    68 else => 69 @cgi.stdinput    70 end    71 end </code>

where @cgi is an ActionController::Integration::Session::StubCGI and the @cgi.stdinput reports to being a StringIO

but when this StringIO method is used to perform a read, I get the error listed above..

Is anyone familiar with posting within integration testing and how I could possibly skirt around this issue?

Thanks for any tips on this issue..

ilan

as a follow up, I found that I had monkey patch conflicts with redhillonrails_core 2.0 which I use for foreign key constraints on my db..

phew..