Where's the doc for get(), post(), put(), delete() & head()?

These HTTP Request methods are used for testing. They are discussed in
the testing chapter of the Agile Web D. with Rails book, as
well as in Peak Obsession “A
Guide to Testing the Rails”.

I want to set the encoding to multipart for a test I’m writing, but I
can’t find any documentation to show me how. Pointing me to the source
code for the methods would be just as good.

I’ve looked all over, and spent a good amount of time searching, so your
help is greatly appreciated!

Thanks!

Maybe you have been looking in the wrong place?

I would look for info on those fx like this
get() +http request methods

http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2

etc

I would also look for
“multipart/form-data” +“http request methods”
found a site to do with ruby I think:
parse talks about multi/parts encoding

this gives an example with method post
http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html
http://wiki.modruby.net/en/?Apache%3A%3ARequest

I have not used forms much, so I am just giving you my ideas on how to
search

View this message in context:
http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3585718
Sent from the RubyOnRails Users forum at Nabble.com.

Thanks for the answer Anne, but I guess I needed to be more specific.

What I’m looking for is the RDOC for the Ruby methods that are shown in
the testing chapter of the Agile Web D. with Rails book.
Finding the Ruby source code for the methods would also work.

I know enough about the HTTP methods, just not enough about the actual
Rails/Ruby method call arguments.

Thanks!
-Steve-

anne001 wrote:

Maybe you have been looking in the wrong place?

I would look for info on those fx like this
get() +http request methods

Hypertext Markup Language - 2.0 - Forms
WDVL - Mastering the Art of Online Magazine Creation
etc

I would also look for
“multipart/form-data” +“http request methods”
found a site to do with ruby I think:
parse talks about multi/parts encoding

this gives an example with method post
http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html
http://wiki.modruby.net/en/?Apache%3A%3ARequest

I have not used forms much, so I am just giving you my ideas on how to
search

View this message in context:
http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3585718
Sent from the RubyOnRails Users forum at Nabble.com.

Stephen A. wrote:

help is greatly appreciated!
Unfortunately there’s no Rdoc for those methods, because they’re
generated in a way that the Rdoc processor can’t pick up. Deeply
irritating, but I’ve got them in
actionpack-1.11.2/action_controller/test_process.rb. Look for:

%w( get post put delete head ).each do |method|
class_eval <<-EOV, FILE, LINE

There’s an entry in the wiki for testing uploaded files that might be
relevant - I’d suggest having a quick google if that’s what you’re
trying to do. There’s some monkeying with CGI, if I remember correctly.

anne001 wrote:

http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html

this is a ruby doc, it has all the key word you asked for, do you think you
are looking for something like that?
Given the context, I think he’s after Test::Unit::TestCase.{put, post,
get} rather that Net::HTTP.{put, post, get}.

Yes, this is exactly what I was looking for. I can see why the RDOC
didn’t pick it up.

Unfortunately, I haven’t been able to determine how to set encoding to
‘multipart/form-data’ by reading this code yet.

The wiki page on testing uploaded files doesn’t cover testing
file_column uploaded files at this point. I’ll add my question to the
Wiki page, as well as any answer I come up with. When I tried to follow
those instructions, the code failed miserably. An experiment I did
makes me think that I might be able to set that field to a string, and
set the post to multipart.

My experimenting so far, make me think that if your code uses the
file_column plugin, then you ought to be able to do something like this:

member_properties[:image_path] = image_path
post :create, {:member => member_properties},
   :encoding => multipart/form-data'

But no matter what I do, the test returns
"test_add_valid_member_with_image(AddMemberTest):
TypeError: Do not know how to handle a string with value
‘/Users/stephen/mi7/test/fixtures/images/DiamondsAndRust.jpg’ that was
passed to a file_column. Check if the form’s encoding has been set to
‘multipart/form-data’.

Maybe I’m barking up the wrong tree…

But thanks for your help regardless!
-Steve-

Alex Y. wrote:

Stephen A. wrote:

help is greatly appreciated!
Unfortunately there’s no Rdoc for those methods, because they’re
generated in a way that the Rdoc processor can’t pick up. Deeply
irritating, but I’ve got them in
actionpack-1.11.2/action_controller/test_process.rb. Look for:

%w( get post put delete head ).each do |method|
class_eval <<-EOV, FILE, LINE

There’s an entry in the wiki for testing uploaded files that might be
relevant - I’d suggest having a quick google if that’s what you’re
trying to do. There’s some monkeying with CGI, if I remember correctly.

http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html

this is a ruby doc, it has all the key word you asked for, do you think
you
are looking for something like that?

View this message in context:
http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3595912
Sent from the RubyOnRails Users forum at Nabble.com.