Rcov not detecting existing and valid test cases


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

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)

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


/ Vahagn