C0 code coverage information
Generated on Tue Dec 04 22:06:27 -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.
1 class Image < ActiveRecord::Base
2 has_attachment :content_type => :image,
3 :storage => :file_system,
4 :path_prefix => 'public/images/recipes',
5 :max_size => 500.kilobytes,
6 :resize_to => '450x338>',
7 :thumbnails => { :thumb => '200x150>' }
8
9 validates_as_attachment
10
11 validates_inclusion_of :resource_type, :in => %w{ Recipe Meal }, :message => 'should be a meal or recipe'
12 validates_presence_of :resource_id
13
14 belongs_to :resource, :polymorphic => true
15
16 def partitioned_path(*args)
17 d = resource.date
18 [ "%4d/%02d/%02d" % [d.year, d.month, d.day] ] + args
19 end
20
21 def full_filename(thumbnail = nil)
22 file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s
23 case thumbnail.to_s || self.thumbnail
24 when "thumb"
25 File.join(RAILS_ROOT, file_system_path, *partitioned_path('thumb', thumbnail_name_for(thumbnail)))
26 else
27 File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail)))
28 end
29 end
30
31 def thumbnail_name_for(thumbnail = nil)
32 filename
33 end
34
35 # over-ride with the respond_to?(:parent_id) conditional (because it
36 # does in this codebase) so that we can also pass in the resource
37 # information
38 def find_or_initialize_thumbnail(file_name_suffix)
39 thumbnail_class.find_or_initialize_by_thumbnail_and_parent_id_and_resource_type_and_resource_id(file_name_suffix.to_s, id,
40 resource_type, resource_id)
41 end
42
43 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.