cover_me icon indicating copy to clipboard operation
cover_me copied to clipboard

Class "end" marked as not executed

Open jcowgar opened this issue 13 years ago • 2 comments

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.

jcowgar avatar Apr 02 '11 16:04 jcowgar

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.

codeodor avatar Apr 11 '11 19:04 codeodor

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.

ylansegal avatar Apr 21 '11 18:04 ylansegal