Forum: Ruby on Rails rcov not detecting request.xhr? test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-02-19 23:23
(Received via mailing list)
I have a method

def index
  if request.xhr?
    @users = User.find( :all )

And then I have a test for it:

def test_index
  user = users( :foo )
  xhr :post, :index, {}, { :user_id => user.user_id }
  assert_response :success
  assert_template 'users/index'

The test works fine.  If I put a puts in there it fires, so I know the
test is hitting the block in question.

So then when I run rcov, it produces a report that says the code block
has not yet been covered with a test.

I also tried xhr :get in my test but got the same result.

Anyone know anything about this?  Is there a workaround, or another way?


Greg Donald
This topic is locked and can not be replied to.