Check out http://railscasts.com/episodes/71-testing-controllers-with-rspec
Gavin
http://handyrailstips.com
On Jun 26, 2:33 am, robokos
<zol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi
>
> I am very new to rspec and would like to learn more. I have googled
> around and asked in irc with no firm answers.
>
> I have the following controller :
>
> class ProductsController < ApplicationController
>
> before_filter :loadsidebar
>
> def show
> @category = Category.find(params[:id])
> @products = @category.products
> end
>
> private
>
> def loadsidebar
> @categories = Category.find(:all)
> end
>
> end
>
> rCov reports that the code in the show and loadsidebar methods is not
> covered. Can someone please guide me to how best to test these?
>
> Thanks,