Testing a scoped find in a Rails controller with RSpec
- by Joseph DelCioppio
I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id.
Here it is:
def index
if(params[:user_id])
@solutions =…