# Rcov not detecting existing and valid test cases

**URL:** <https://www.ruby-forum.com/t/rcov-not-detecting-existing-and-valid-test-cases/157036>\
**Category:** Rails\
**Created:** [January 6, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/rcov-not-detecting-existing-and-valid-test-cases/157036 "2009-01-06T18:01:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vahagn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/cc9497/32.png) [@vahagn](https://www.ruby-forum.com/u/vahagn)\
**Post date:** [January 6, 2009, 6:01pm UTC](https://www.ruby-forum.com/t/rcov-not-detecting-existing-and-valid-test-cases/157036/1 "2009-01-06T18:01:43Z")

</div>

Hello,-

got a question regarding strange behavior by rcov.

I have a gyms\_controller.rb with the usual group of CRUD methods. Each  
one of them is being tested in the gyms\_controller\_test.rb:

$ ruby test/functional/gyms\_controller\_test.rb  
Loaded suite test/functional/gyms\_controller\_test  
Started  
…  
Finished in 5.985611 seconds.

9 tests, 20 assertions, 0 failures, 0 errors

So far, so good.

Then, I’ve installed rcov and the majority of the code that is being  
tested is marked as not covered by the test. In particular, the fairly  
trivial test for the index action:

5 # GET /gyms  
6 # GET /gyms.xml  
7 def index  
8 @gyms = Gym.find(:all)  
9 respond\_to do |format|  
10 format.html # index.html.erb  
11 format.xml { render :xml =\> @gyms }  
12 end  
13 end

And the test:

def test\_should\_get\_index  
get :index  
assert\_response :success  
assert\_not\_nil assigns(:gyms)  
end

This is a test that is being executed and does not fail. How come it’s  
not detected by rcov??

Thanks!

/ Vahagn
