C0 code coverage information

Generated on Mon Aug 13 01:18:54 -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.
Name Total lines Lines of code Total coverage Code coverage
lib/spec/matchers/include.rb 70 45
100.0% 
100.0% 
 1 module Spec
 2   module Matchers
 3 
 4     class Include #:nodoc:
 5       
 6       def initialize(*expecteds)
 7         @expecteds = expecteds
 8       end
 9       
10       def matches?(actual)
11         @actual = actual
12         @expecteds.each do |expected|
13           return false unless actual.include?(expected)
14         end
15         true
16       end
17       
18       def failure_message
19         _message
20       end
21       
22       def negative_failure_message
23         _message("not ")
24       end
25       
26       def description
27         "include #{_pretty_print(@expecteds)}"
28       end
29       
30       private
31         def _message(maybe_not="")
32           "expected #{@actual.inspect} #{maybe_not}to include #{_pretty_print(@expecteds)}"
33         end
34         
35         def _pretty_print(array)
36           result = ""
37           array.each_with_index do |item, index|
38             if index < (array.length - 2)
39               result << "#{item.inspect}, "
40             elsif index < (array.length - 1)
41               result << "#{item.inspect} and "
42             else
43               result << "#{item.inspect}"
44             end
45           end
46           result
47         end
48     end
49 
50     # :call-seq:
51     #   should include(expected)
52     #   should_not include(expected)
53     #
54     # Passes if actual includes expected. This works for
55     # collections and Strings. You can also pass in multiple args
56     # and it will only pass if all args are found in collection.
57     #
58     # == Examples
59     #
60     #   [1,2,3].should include(3)
61     #   [1,2,3].should include(2,3) #would pass
62     #   [1,2,3].should include(2,3,4) #would fail
63     #   [1,2,3].should_not include(4)
64     #   "spread".should include("read")
65     #   "spread".should_not include("red")
66     def include(*expected)
67       Matchers::Include.new(*expected)
68     end
69   end
70 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.

Valid XHTML 1.0! Valid CSS!