Geminstaller C0 Coverage Information - RCov

/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/matchers/include.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/matchers/include.rb 44 27
84.09%
74.07%

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 Spec
2   module Matchers
3     # :call-seq:
4     #   should include(expected)
5     #   should_not include(expected)
6     #
7     # Passes if actual includes expected. This works for
8     # collections and Strings. You can also pass in multiple args
9     # and it will only pass if all args are found in collection.
10     #
11     # == Examples
12     #
13     #   [1,2,3].should include(3)
14     #   [1,2,3].should include(2,3) #would pass
15     #   [1,2,3].should include(2,3,4) #would fail
16     #   [1,2,3].should_not include(4)
17     #   "spread".should include("read")
18     #   "spread".should_not include("red")
19     def include(*expected)
20       Matcher.new :include, *expected do |*_expected_|
21         match do |actual|
22           helper(actual, *_expected_)
23         end
24         
25         def helper(actual, *_expected_)
26           _expected_.each do |expected|
27             if actual.is_a?(Hash)
28               if expected.is_a?(Hash)
29                 expected.each_pair do |k,v|
30                   return false unless actual[k] == v
31                 end
32               else
33                 return false unless actual.has_key?(expected)
34               end
35             else
36               return false unless actual.include?(expected)
37             end
38           end
39           true
40         end
41       end
42     end
43   end
44 end

Generated on Mon May 10 23:40:27 -0700 2010 with rcov 0.9.8