Today, I had the problem that rcov on one machine produced outputs like 50% or 48% for some files while on some other machine the coverage was 100% or at least >95%. When looking at the rcov output, I noticed that the contents of the files that made problems were duplicated, first the correct results and then again the whole class, this time with every single line marked as being not covered.
The affected files were sessions_controller.rb, user_controller.rb and user_mailer.rb. This made me think of where those files came originally from: The restful authentication plugin. I had a look on the test files for these and their beginning looked like this (test/functional/sessions_controller_test.rb here):
Why is sessions_controller included/required there? I don't know why the restful authentication plugin put those instructions there, but you can just remove them from the affected files and you will be fine.
I suspect that this issue only comes up with older rcov versions, because my development machine with current rcov does not have a problem with the require instructions.
The affected files were sessions_controller.rb, user_controller.rb and user_mailer.rb. This made me think of where those files came originally from: The restful authentication plugin. I had a look on the test files for these and their beginning looked like this (test/functional/sessions_controller_test.rb here):
require 'test_helper'
require 'sessions_controller'
# Re-raise errors caught by the controller.
class SessionsController; def rescue_action(e) raise e end; end
require 'sessions_controller'
# Re-raise errors caught by the controller.
class SessionsController; def rescue_action(e) raise e end; end
Why is sessions_controller included/required there? I don't know why the restful authentication plugin put those instructions there, but you can just remove them from the affected files and you will be fine.
I suspect that this issue only comes up with older rcov versions, because my development machine with current rcov does not have a problem with the require instructions.