markbates / cover_me

An RCov-esque coverage tool for Ruby 1.9
http://www.metabates.com
MIT License
203 stars 18 forks source link

Class "end" marked as not executed #36

Open jcowgar opened 13 years ago

jcowgar commented 13 years ago
1:  class ApplicationController < ActionController::Base 21
2:    protect_from_forgery 21
3:
4:    rescue_from CanCan::AccessDenied do |exception| 8
5:      redirect_to root_path, :alert => t('auth.not_permitted') 5
6:    end 1
7:  end 0

With this being such a small file, it then appears in red as it is reported as 83.3% tested due to the class end not being counted as executed.

codeodor commented 13 years ago

I'm having the same issue, but not necessarily only on classes. For instance:

if @user.update_attributes(params[:user])
    format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
    format.xml  { head :ok }
  else
    format.html { render :action => "edit" }
    format.xml  { render :xml => @user.errors, :status => :unprocessable_entity }
  end # this line is marked as not having been executed

I just realized that it seemed to go away. I don't think I changed anything in the file, but upon running the tests again (perhaps several times) the coverage has gone up to 100%. I'll try to pay closer attention in the future to see if I can narrow down the cause/fix of the errant behavior.

ylansegal commented 13 years ago

I guess I am not adding much, but I see the same behavior: lines with only "end" on them and sometimes blank lines being counted as not tested.