Dagnabit C0 Coverage Information - RCov

lib/dagnabit/link/cycle_prevention.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/dagnabit/link/cycle_prevention.rb 31 16
100.00%
100.00%

Key

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.

Coverage Details

1 module Dagnabit
2   module Link
3     #
4     # Installs a callback into the link model to check for cycles.  If a cycle
5     # would be created by the addition of this link, prevents the link from
6     # being saved.
7     #
8     module CyclePrevention
9       #
10       # Performs cycle detection.
11       #
12       # Given an edge (A, B), insertion of that edge will create a cycle if
13       #
14       # * there is a path (B, A), or
15       # * A == B
16       #
17       def before_save
18         super
19         check_for_cycles 
20       end
21 
22       private
23 
24       def check_for_cycles
25         if ancestor && descendant
26           false if self.class.path?(descendant, ancestor) || descendant == ancestor
27         end
28       end
29     end
30   end
31 end

Generated on Tue Dec 08 04:06:14 -0600 2009 with rcov 0.9.6