Geminstaller C0 Coverage Information - RCov

/Users/woolley/.rvm/gems/ruby-1.8.7-p174@geminstaller/gems/rspec-1.3.0/lib/spec/mocks/argument_expectation.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/mocks/argument_expectation.rb 51 40
98.04%
97.50%

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 Mocks
3     
4     class ArgumentExpectation
5       attr_reader :args
6       
7       def initialize(args, &block)
8         @args = args
9         @matchers_block = block
10         @match_any_args = false
11         @matchers = nil
12         
13         if ArgumentMatchers::AnyArgsMatcher === args.first
14           @match_any_args = true
15         elsif ArgumentMatchers::NoArgsMatcher === args.first
16           @matchers = []
17         else
18           @matchers = args.collect {|arg| matcher_for(arg)}
19         end
20       end
21       
22       def matcher_for(arg)
23         return ArgumentMatchers::MatcherMatcher.new(arg)   if is_matcher?(arg)
24         return ArgumentMatchers::RegexpMatcher.new(arg) if arg.is_a?(Regexp)
25         return ArgumentMatchers::EqualityProxy.new(arg)
26       end
27       
28       def is_matcher?(obj)
29         return obj.respond_to?(:matches?) & obj.respond_to?(:description)
30       end
31       
32       def args_match?(given_args)
33         match_any_args? || matchers_block_matches?(given_args) || matchers_match?(given_args)
34       end
35       
36       def matchers_block_matches?(given_args)
37         @matchers_block ? @matchers_block.call(*given_args) : nil
38       end
39       
40       def matchers_match?(given_args)
41         @matchers == given_args
42       end
43       
44       def match_any_args?
45         @match_any_args
46       end
47       
48     end
49     
50   end
51 end

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