C0 code coverage information
Generated on Mon Aug 13 01:18:53 -0400 2007 with rcov 0.8.0
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 Spec
2 module DSL
3 class BehaviourFactory
4
5 class << self
6
7 BEHAVIOUR_CLASSES = {:default => Spec::DSL::Behaviour}
8
9 # Registers a behaviour class +klass+ with the symbol
10 # +behaviour_type+. For example:
11 #
12 # Spec::DSL::BehaviourFactory.add_behaviour_class(:farm, Spec::Farm::DSL::FarmBehaviour)
13 #
14 # This will cause Kernel#describe from a file living in
15 # <tt>spec/farm</tt> to create behaviour instances of type
16 # Spec::Farm::DSL::FarmBehaviour.
17 def add_behaviour_class(behaviour_type, klass)
18 BEHAVIOUR_CLASSES[behaviour_type] = klass
19 end
20
21 def remove_behaviour_class(behaviour_type)
22 BEHAVIOUR_CLASSES.delete(behaviour_type)
23 end
24
25 def create(*args, &block)
26 opts = Hash === args.last ? args.last : {}
27 if opts[:shared]
28 behaviour_type = :default
29 elsif opts[:behaviour_type]
30 behaviour_type = opts[:behaviour_type]
31 elsif opts[:spec_path] =~ /spec(\\|\/)(#{BEHAVIOUR_CLASSES.keys.join('|')})/
32 behaviour_type = $2.to_sym
33 else
34 behaviour_type = :default
35 end
36 return BEHAVIOUR_CLASSES[behaviour_type].new(*args, &block)
37 end
38
39 end
40 end
41 end
42 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.