[rspec-devel] [ rspec-Patches-8509 ] Enhance controller docs

noreply at rubyforge.org noreply at rubyforge.org
Thu Feb 8 09:13:39 EST 2007


Patches item #8509, was opened at 2007-02-08 14:13
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=8509&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jerry West (jjw)
Assigned to: Nobody (None)
Summary: Enhance controller docs 

Initial Comment:
The controller spec docs assume some familiarity with Rails unit testing concepts . This assumption is increasingly in-appropriate as newcomers to Rails start with RSpec as their prefered development 'test' tool.

An immediate request is to update the controller specs documentation to include something like this:

Triggering controller actions

Once the expectations have been established, the controller action must be invoked.  Three helper routines are provided to emulate the HTTP GET and POST expected by the controller:

  get :action, [params]

  post :action, params

  xhr :get, :action, [params]
 
  xhr :post, :action, params

The #xhr method emulates an AJAX (xml_http_request) call.  

'params' is a hash to be placed in the params[] accessor in the controller (e.g. :id => 99, :name => 'fred', etc).  The 'action' can be either a symbol or a string.



-------

The example at the end might also be enhanced to illustrate usage.

  xhr :post, :update, :id => 3, :name => 'fred'



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=8509&group_id=797


More information about the rspec-devel mailing list