Stephen Anderson
2006-Mar-25 02:45 UTC
[Rails] 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 Development with Rails book, as well as in http://manuals.rubyonrails.com/read/chapter/28#page72 "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! -- Posted via http://www.ruby-forum.com/.
anne001
2006-Mar-25 11:01 UTC
[Rails] Where''s the doc for get(), post(), put(), delete() & head()?
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 http://wdvl.com/Internet/Protocols/HTTP/Request.html 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%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3585718 Sent from the RubyOnRails Users forum at Nabble.com.
Stephen Anderson
2006-Mar-25 19:48 UTC
[Rails] Re: Where''s the RDOC for post testing method?
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 Development 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 > > http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2 > http://wdvl.com/Internet/Protocols/HTTP/Request.html > 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%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3585718 > Sent from the RubyOnRails Users forum at Nabble.com.-- Posted via http://www.ruby-forum.com/.
Alex Young
2006-Mar-26 10:02 UTC
[Rails] Where''s the doc for get(), post(), put(), delete() & head()?
Stephen Anderson wrote:> These HTTP Request methods are used for testing. They are discussed in > the testing chapter of the Agile Web Development with Rails book, as > well as in http://manuals.rubyonrails.com/read/chapter/28#page72 "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!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. -- Alex
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%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3595912 Sent from the RubyOnRails Users forum at Nabble.com.
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}. -- Alex
Stephen Anderson
2006-Mar-26 20:48 UTC
[Rails] Re: Where''s the doc for get(), post(), put(), delete() & he
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 Young wrote:> Stephen Anderson 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.-- Posted via http://www.ruby-forum.com/.