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.
1 module Spec
2 module Matchers
3 class BaseOperatorMatcher
4
5 def initialize(target)
6 @target = target
7 end
8
9 def ==(expected)
10 @expected = expected
11 __delegate_method_missing_to_target("==", expected)
12 end
13
14 def ===(expected)
15 @expected = expected
16 __delegate_method_missing_to_target("===", expected)
17 end
18
19 def =~(expected)
20 @expected = expected
21 __delegate_method_missing_to_target("=~", expected)
22 end
23
24 def >(expected)
25 @expected = expected
26 __delegate_method_missing_to_target(">", expected)
27 end
28
29 def >=(expected)
30 @expected = expected
31 __delegate_method_missing_to_target(">=", expected)
32 end
33
34 def <(expected)
35 @expected = expected
36 __delegate_method_missing_to_target("<", expected)
37 end
38
39 def <=(expected)
40 @expected = expected
41 __delegate_method_missing_to_target("<=", expected)
42 end
43
44 def fail_with_message(message)
45 Spec::Expectations.fail_with(message, @expected, @target)
46 end
47
48 end
49
50 class PositiveOperatorMatcher < BaseOperatorMatcher #:nodoc:
51
52 def __delegate_method_missing_to_target(operator, expected)
53 ::Spec::Matchers.generated_description = "should #{operator} #{expected.inspect}"
54 return if @target.send(operator, expected)
55 return fail_with_message("expected: #{expected.inspect},\n got: #{@target.inspect} (using #{operator})") if ['==','===', '=~'].include?(operator)
56 return fail_with_message("expected: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{@target.inspect}")
57 end
58
59 end
60
61 class NegativeOperatorMatcher < BaseOperatorMatcher #:nodoc:
62
63 def __delegate_method_missing_to_target(operator, expected)
64 ::Spec::Matchers.generated_description = "should not #{operator} #{expected.inspect}"
65 return unless @target.send(operator, expected)
66 return fail_with_message("expected not: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{@target.inspect}")
67 end
68
69 end
70
71 end
72 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.