C0 code coverage information
Generated on Sun Oct 26 21:43:35 -0700 2008 with rcov 0.8.1.2
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 Matchers
3
4 class RespondTo #:nodoc:
5 def initialize(*names)
6 @names = names
7 @names_not_responded_to = []
8 end
9
10 def matches?(target)
11 @names.each do |name|
12 unless target.respond_to?(name)
13 @names_not_responded_to << name
14 end
15 end
16 return @names_not_responded_to.empty?
17 end
18
19 def failure_message
20 "expected target to respond to #{@names_not_responded_to.collect {|name| name.inspect }.join(', ')}"
21 end
22
23 def negative_failure_message
24 "expected target not to respond to #{@names.collect {|name| name.inspect }.join(', ')}"
25 end
26
27 def description
28 "respond to ##{@names.to_s}"
29 end
30 end
31
32 # :call-seq:
33 # should respond_to(*names)
34 # should_not respond_to(*names)
35 #
36 # Matches if the target object responds to all of the names
37 # provided. Names can be Strings or Symbols.
38 #
39 # == Examples
40 #
41 def respond_to(*names)
42 Matchers::RespondTo.new(*names)
43 end
44 end
45 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.