I am using simplecov gem to view test coverage. In following image, I can see two statements else
and end
are in white colour.
Are these lines not counted in test coverage? If yes, what can be done to include such statements ?
These aren't lines of code. You can't test them, so simplecov ignores them.
Your if
has been covered, so because of that we assume that the end has been covered. The else
is also not covered, but we only care that the code inside that branch has been covered.
SimpleCov should untested code as a red line and untestable code as grey. The code above has 100% test coverage, so don't worry.