Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-expectations-2.5.0/lib/rspec/expectations/handler.rb | 50 | 41 | 32.00%
|
29.27%
|
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 RSpec |
2 module Expectations |
3 class InvalidMatcherError < ArgumentError; end |
4 |
5 class PositiveExpectationHandler |
6 def self.handle_matcher(actual, matcher, message=nil, &block) |
7 ::RSpec::Matchers.last_should = :should |
8 ::RSpec::Matchers.last_matcher = matcher |
9 return ::RSpec::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil? |
10 |
11 match = matcher.matches?(actual, &block) |
12 return match if match |
13 |
14 message ||= matcher.respond_to?(:failure_message_for_should) ? |
15 matcher.failure_message_for_should : |
16 matcher.failure_message |
17 |
18 if matcher.respond_to?(:diffable?) && matcher.diffable? |
19 ::RSpec::Expectations.fail_with message, matcher.expected.first, matcher.actual |
20 else |
21 ::RSpec::Expectations.fail_with message |
22 end |
23 end |
24 end |
25 |
26 class NegativeExpectationHandler |
27 def self.handle_matcher(actual, matcher, message=nil, &block) |
28 ::RSpec::Matchers.last_should = :should_not |
29 ::RSpec::Matchers.last_matcher = matcher |
30 return ::RSpec::Matchers::NegativeOperatorMatcher.new(actual) if matcher.nil? |
31 |
32 match = matcher.respond_to?(:does_not_match?) ? |
33 !matcher.does_not_match?(actual, &block) : |
34 matcher.matches?(actual, &block) |
35 return match unless match |
36 |
37 message ||= matcher.respond_to?(:failure_message_for_should_not) ? |
38 matcher.failure_message_for_should_not : |
39 matcher.negative_failure_message |
40 |
41 if matcher.respond_to?(:diffable?) && matcher.diffable? |
42 ::RSpec::Expectations.fail_with message, matcher.expected.first, matcher.actual |
43 else |
44 ::RSpec::Expectations.fail_with message |
45 end |
46 end |
47 end |
48 end |
49 end |
50 |
Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8