[rspec-users] Passing get request parameters in an rspec test

Matt Kolenda mkolenda at gmail.com
Fri Apr 2 13:16:45 EDT 2010


Please forgive my noobness to rspec.  I have a controller method that
inspects the params[:id] object and renders a view that depends on the
existence of that :id.

I want to ensure that the view is rendered in the controller rspec test.
The rspec code is:

  describe "GET 'enrollments'" do
    it "should be successful" do
      get 'enrollments'
      response.should be_success

The 'enrollments' controller method inspects the params object, pulls out
the :id and uses it in a few queries to populate a couple of instance

My question is "How do I pass in the params[:id] parameter to the get
'enrollments' line?"

Thanks in advance

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100402/6da5abf6/attachment.html>

More information about the rspec-users mailing list