Hi,

I am working on a mobile app that sends a post with a file (a picture)
"embedded" in the body of the request. It is not inside a parameter,
it is inside of the body. A simplified example of a curl statement to
simulate what the request does could be this:

curl -X POST my_path --data-binary my_file

When the request gets to the controller the contents of the file can
be retrieved like this:

str = self.request.body.read

I can run my tests running a server and outside of rspec and directing
curl requests to localhost but that slows down the tests considerably.
I need to reproduce what the curl statement does from within my tests
and using only the server that rspec starts but I don't know how.
Nothing that I have tried has worked and I am kind of running out of
time. My latest idea (not fully explored yet) is to work with the
request object itself before running the POST statement but I have not
found a way to load the body with the binary contents of a file yet
and I am not sure this will actually even work.

Any help would be greatly appreciated.

Thank you

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to