| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| app/models/extra_mark.rb | 29 | 21 | 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 ExtraMark < ActiveRecord::Base |
2 # When a mark is created, or updated, we need to make sure that that |
3 # Result that it belongs to has a marking_state of "partial". |
4 UNITS = { |
5 :percentage => 'percentage', |
6 :points => 'points' |
7 } |
8 |
9 named_scope :points, :conditions => {:unit => ExtraMark::UNITS[:points]} |
10 named_scope :percentage, :conditions => {:unit => ExtraMark::UNITS[:percentage]} |
11 |
12 named_scope :positive, :conditions => ['extra_mark > 0'] |
13 named_scope :negative, :conditions => ['extra_mark < 0'] |
14 |
15 |
16 before_save :ensure_not_released_to_students |
17 before_update :ensure_not_released_to_students |
18 |
19 belongs_to :result |
20 validates_presence_of :unit |
21 validates_format_of :unit, :with => /percentage|points/ |
22 validates_presence_of :result_id |
23 validates_numericality_of :extra_mark, :message => "Mark must be an number" |
24 validates_numericality_of :result_id, :only_integer => true, :greater_than => 0, :message => "result_id must be an id that is an integer greater than 0" |
25 |
26 def ensure_not_released_to_students |
27 return !result.released_to_students |
28 end |
29 end |
Generated on Wed Sep 08 00:10:30 -0400 2010 with rcov 0.9.8