# rSpec Newbie Question - Testing controller

**URL:** <https://www.ruby-forum.com/t/rspec-newbie-question-testing-controller/171078>\
**Category:** Rails\
**Created:** [June 26, 2009, 3:34am UTC](https://www.ruby-forum.com/t/rspec-newbie-question-testing-controller/171078 "2009-06-26T03:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rzolkos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@rzolkos](https://www.ruby-forum.com/u/rzolkos)\
**Post date:** [June 26, 2009, 3:34am UTC](https://www.ruby-forum.com/t/rspec-newbie-question-testing-controller/171078/1 "2009-06-26T03:34:45Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![rzolkos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@rzolkos](https://www.ruby-forum.com/u/rzolkos)\
**Post date:** [June 26, 2009, 9:48am UTC](https://www.ruby-forum.com/t/rspec-newbie-question-testing-controller/171078/2 "2009-06-26T09:48:27Z")

</div>

Check out

> **[\#71 Testing Controllers with RSpec - RailsCasts](http://railscasts.com/episodes/71-testing-controllers-with-rspec)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

Gavin

> **[Ruby on Rails tips & Tutorials](https://handyrailstips.com)**
>
> Ruby on Rails tips and tutorials
