I am trying to test my update method: put :update, {:id => topics(:one).id, :topics => {:title => ''Updated Unique Title''}}, {:user => users(:admin).id, :user_role => users(:admin).role.name} The above statement works fine and test returns positive result. I thought doing post for an update should fail: post :update, {:id => topics(:one).id, :topics => {:title => ''Updated Unique Title''}}, {:user => users(:admin).id, :user_role => users(:admin).role.name} However, this also works. So even after doing RESTful routing post for update and destroy will work or what? Thanks, CS. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
REST is a suggested architecture style. Rails does not enforce it. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m pretty sure that the functional test helpers don''t run through the router - that''s why you can do ''post :update'', rather than ''post "/ some/path/to/update"'' like you would in an integration test. --Matt Jones On Apr 12, 3:42 pm, Carlos Santana <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am trying to test my update method: > put :update, {:id => topics(:one).id, :topics => {:title => ''Updated > Unique Title''}}, {:user => users(:admin).id, :user_role => > users(:admin).role.name} > > The above statement works fine and test returns positive result. I > thought doing post for an update should fail: > post :update, {:id => topics(:one).id, :topics => {:title => ''Updated > Unique Title''}}, {:user => users(:admin).id, :user_role => > users(:admin).role.name} > > However, this also works. So even after doing RESTful routing post for > update and destroy will work or what? > > Thanks, > CS. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Something is wrong - may be my understanding of REST. Following is the output using curl. $ curl -X POST http://localhost:3000/topics/update/1 <html><body>You are being <a href="http://localhost:3000/topics/1">redirected</a>.</body></html> Mongrel: Processing TopicsController#update (for 127.0.0.1 at 2009-04-13 18:26:01) [POST] Session ID: 9dc3bd98a336027e75b2b4836967b497 Parameters: {"action"=>"update", "id"=>"1", "controller"=>"topics"} Anonymous Columns (0.001320) SHOW FIELDS FROM `users` Topic Columns (0.001158) SHOW FIELDS FROM `topics` Topic Load (0.000609) SELECT * FROM `topics` WHERE (`topics`.`id` = 1) CACHE (0.000000) SELECT * FROM `topics` WHERE (`topics`.`id` = 1) SQL (0.000169) BEGIN SQL (0.000435) SELECT `title` FROM `topics` WHERE (`topics`.title = ''test'' AND `topics`.id <> 1) SQL (0.000157) COMMIT Redirected to http://localhost:3000/topics/1 Completed in 0.04002 (24 reqs/sec) | DB: 0.00423 (10%) | 302 Found [http://localhost/topics/update/1] Following is my routes file. map.resources :topics do |topics| topics.resources :items do |items| items.resources :attachments, :member => {:view_pdf => :get} end end Is this okay/expected behavior? Or am I missing something? Thanks, CS. Matt Jones wrote:> I''m pretty sure that the functional test helpers don''t run through the > router - that''s why you can do ''post :update'', rather than ''post "/ > some/path/to/update"'' like you would in an integration test. > > --Matt Jones >-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think RESTful urls like edit_topic_url(id) work using REST. So routing is coming into the picture. Matt Jones wrote:> I''m pretty sure that the functional test helpers don''t run through the > router - that''s why you can do ''post :update'', rather than ''post "/ > some/path/to/update"'' like you would in an integration test. > > --Matt Jones > > On Apr 12, 3:42�pm, Carlos Santana <rails-mailing-l...@andreas-s.net>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matt, I think you are right. Functional test helpers aren''t referring to routing. :( Any more thoughts on this? - CS. Carlos Santana wrote:> I think RESTful urls like edit_topic_url(id) work using REST. So routing > is coming into the picture. > > Matt Jones wrote: >> I''m pretty sure that the functional test helpers don''t run through the >> router - that''s why you can do ''post :update'', rather than ''post "/ >> some/path/to/update"'' like you would in an integration test. >> >> --Matt Jones >>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---