C0 code coverage information

Generated on Tue Dec 04 22:06:26 -0500 2007 with rcov 0.8.0


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
app/controllers/image_controller.rb 71 45
100.0% 
100.0% 
 1 #####
 2 #
 3 # Copyright 2007 Chris Strom, Robin Strom
 4 #
 5 # This file is part of EEE Code.
 6 #
 7 # EEE Code is free software: you can redistribute it and/or modify
 8 # it under the terms of the GNU General Public License as published by
 9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # EEE Code is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with EEE Code.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 class ImageController < ApplicationController
21   before_filter :login_required
22   before_filter :set_common
23   before_filter :resource_type_required
24 
25   layout 'master'
26 
27   def new
28     @resource = @resource_class.find(params[:resource_id])
29     @image = @resource.build_image
30   end
31 
32   def create
33     @image = Image.new(params[:image])
34     if @image.save
35       flash[:notice] = 'Image was successfully created.'
36       redirect_to "/#{@resource_type.pluralize}/#{@image.resource.uri}"
37     else
38       @resource = @resource_class.find(params[:resource_id])
39       render :action => 'new'
40     end
41   end
42 
43   def destroy
44     @image = Image.find(params[:id])
45     if @image.destroy
46       flash[:notice] = 'Image was successfully removed.'
47     else
48       flash[:notice] = 'Unable to remove image.'
49     end
50     redirect_to "/#{@resource_type.pluralize}/#{@image.resource.uri}"
51   end
52 
53   private
54   def set_common
55     if @resource_type = params[:resource_type] && params[:resource_type].downcase
56       @resource_class = @resource_type.classify.constantize
57       @title = @resource_type.titleize + ' Image'
58     end
59   end
60 
61   def resource_type_required
62     if !@resource_type || !%w|meal recipe|.include?(@resource_type)
63       flash[:notice] = "Can only update Meal/Recipe images."
64       redirect_to(:controller => "home", :action => "interstitial")
65     end
66   end
67 
68   def authorized?
69     current_user.author?
70   end
71 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.

Valid XHTML 1.0! Valid CSS!