Jul
13th
Fri
13th
Code coverage for restful actions
If a respond_to block in a restful action is run for one type, rcov wrongly assumes the blocks for the other types are also covered. If you put the code in a seperate function, rcov will correctly detect it if it is not tested.
def new
@payment = Payment.new(params[:payment])
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @payment }
format.js {
this_code_is_not_tested_and_not_detected_by_rcov
}
end
end