I have an Ajax responder method which uses respond_to to make sure it only works with Ajax. I''m having trouble figuring out how to call this action successfully. I''m using Rails 1.2.x. Any thoughts? -- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Kevin,<br> <br> You can use #xhr instead of #get or #post, thus...<br> <br> xhr :post, :create, :id => etc...<br> <br> this will send something that the controller is able to recognise as an AJAX request.<br> <br> #xhr is inherited from the original <a href="http://api.rubyonrails.org/classes/ActionController/TestProcess.html#M000065">Rails test framework</a>, but rather taken for granted in the Rspec docs (I''ll submit a request to improve them).<br> <br> Hope this helps,<br> Jerry<br> <br> Kevin Williams wrote: <blockquote cite="mid683a886f0702072117i3aaa4fbcs52c9a2fe1fa2cf27@mail.gmail.com" type="cite"> <pre wrap="">I have an Ajax responder method which uses respond_to to make sure it only works with Ajax. I''m having trouble figuring out how to call this action successfully. I''m using Rails 1.2.x. Any thoughts? </pre> </blockquote> </body> </html>
Sweet! I can''t wait to try that tonight. Thanks! On 2/8/07, Jerry West <jerry.west at ntlworld.com> wrote:> > Kevin, > > You can use #xhr instead of #get or #post, thus... > > xhr :post, :create, :id => etc... > > this will send something that the controller is able to recognise as an > AJAX request. > > #xhr is inherited from the original Rails test framework, but rather taken > for granted in the Rspec docs (I''ll submit a request to improve them). > > Hope this helps, > Jerry > > Kevin Williams wrote: > I have an Ajax responder method which uses respond_to to make sure it > only works with Ajax. I''m having trouble figuring out how to call this > action successfully. I''m using Rails 1.2.x. Any thoughts? > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Cheers, Kevin Williams http://www.almostserio.us/ "Any sufficiently advanced technology is indistinguishable from Magic." - Arthur C. Clarke
On 2/8/07, Jerry West <jerry.west at ntlworld.com> wrote:> > Kevin, > > You can use #xhr instead of #get or #post, thus... > > xhr :post, :create, :id => etc... > > this will send something that the controller is able to recognise as an > AJAX request.This part seems to work, but when I do: controller.should_render_rjs :replace_html ''div_id'', ''some text'' I get nil does not respond to ''rjs'' or ''has_rjs'' Any help would be appreciated. Thanks> > #xhr is inherited from the original Rails test framework, but rather taken > for granted in the Rspec docs (I''ll submit a request to improve them). > > Hope this helps, > Jerry > > Kevin Williams wrote: > I have an Ajax responder method which uses respond_to to make sure it > only works with Ajax. I''m having trouble figuring out how to call this > action successfully. I''m using Rails 1.2.x. Any thoughts? > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Ed Howland http://greenprogrammer.blogspot.com