| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| app/models/assignment_file.rb | 18 | 13 | 100.00%
|
100.00%
|
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 AssignmentFile < ActiveRecord::Base |
2 belongs_to :assignment |
3 |
4 validates_presence_of :filename |
5 validates_uniqueness_of :filename, :scope => :assignment_id |
6 validates_format_of :filename, :with => /^([\w\.{0,1}-])+$/, |
7 :message => "must be alphanumeric, '.' or '-' only" |
8 |
9 # sanitize filename input before saving |
10 def before_save |
11 filename.strip! |
12 filename.gsub(/^(..)+/, ".") |
13 filename.gsub(/[^\s]/, "") # replace spaces with |
14 # replace all non alphanumeric, underscore or periods with underscore |
15 filename.gsub(/^[\W]+$/, '_') |
16 end |
17 |
18 end |
Generated on Wed Sep 08 00:10:30 -0400 2010 with rcov 0.9.8