| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| app/models/extra_mark.rb | 28 | 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 scope :points, :conditions => {:unit => ExtraMark::UNITS[:points]} |
10 scope :percentage, :conditions => {:unit => ExtraMark::UNITS[:percentage]} |
11 |
12 scope :positive, :conditions => ['extra_mark > 0'] |
13 scope :negative, :conditions => ['extra_mark < 0'] |
14 |
15 before_save :ensure_not_released_to_students |
16 before_update :ensure_not_released_to_students |
17 |
18 belongs_to :result |
19 validates_presence_of :unit |
20 validates_format_of :unit, :with => /percentage|points/ |
21 validates_presence_of :result_id |
22 validates_numericality_of :extra_mark, :message => "Mark must be an number" |
23 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" |
24 |
25 def ensure_not_released_to_students |
26 return !result.released_to_students |
27 end |
28 end |
Generated on Sun Feb 05 00:08:07 -0500 2012 with rcov 0.9.10