| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| lib/dagnabit/link/validations.rb | 26 | 12 | 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 module Dagnabit |
2 module Link |
3 # |
4 # Basic validations on link models. |
5 # |
6 # This module only installs ancestor and descendant presence validations; |
7 # the only basic requirement for a link is that it have a valid start point |
8 # and a valid end point. We validate the presence of the +ancestor+ and |
9 # +descendant+, instead of +ancestor_id+ and +descendant_id+, in order to |
10 # permit scenarios like this: |
11 # |
12 # n1 = Node.new |
13 # n2 = Node.new |
14 # l = Link.new(:ancestor => n1, :descendant => n2) |
15 # l.save # will save l, n1, and n2 |
16 # |
17 module Validations |
18 def self.extended(base) |
19 base.send(:validates_presence_of, :ancestor) |
20 base.send(:validates_presence_of, :descendant) |
21 base.send(:validates_associated, :ancestor) |
22 base.send(:validates_associated, :descendant) |
23 end |
24 end |
25 end |
26 end |
Generated on Tue Dec 08 04:06:14 -0600 2009 with rcov 0.9.6