Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-expectations-2.5.0/lib/rspec/matchers/has.rb | 35 | 25 | 51.43%
|
40.00%
|
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 Matchers |
3 |
4 class Has |
5 |
6 def initialize(expected, *args) |
7 @expected, @args = expected, args |
8 end |
9 |
10 def matches?(actual) |
11 actual.__send__(predicate(@expected), *@args) |
12 end |
13 |
14 def failure_message_for_should |
15 "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return true, got false" |
16 end |
17 |
18 def failure_message_for_should_not |
19 "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return false, got true" |
20 end |
21 |
22 def description |
23 "have key #{@args[0].inspect}" |
24 end |
25 |
26 private |
27 |
28 def predicate(sym) |
29 "#{sym.to_s.sub("have_","has_")}?".to_sym |
30 end |
31 |
32 end |
33 |
34 end |
35 end |
Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8