Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-expectations-2.5.0/lib/rspec/matchers/equal.rb | 53 | 31 | 30.19%
|
9.68%
|
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 # :call-seq: |
5 # should equal(expected) |
6 # should_not equal(expected) |
7 # |
8 # Passes if actual and expected are the same object (object identity). |
9 # |
10 # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby. |
11 # |
12 # == Examples |
13 # |
14 # 5.should equal(5) #Fixnums are equal |
15 # "5".should_not equal("5") #Strings that look the same are not the same object |
16 def equal(expected) |
17 Matcher.new :equal, expected do |_expected_| |
18 match do |actual| |
19 actual.equal?(_expected_) |
20 end |
21 |
22 def inspect_object(o) |
23 "#<#{o.class}:#{o.object_id}> => #{o.inspect}" |
24 end |
25 |
26 failure_message_for_should do |actual| |
27 <<-MESSAGE |
28 |
29 expected #{inspect_object(_expected_)} |
30 got #{inspect_object(actual)} |
31 |
32 Compared using equal?, which compares object identity, |
33 but expected and actual are not the same object. Use |
34 'actual.should == expected' if you don't care about |
35 object identity in this example. |
36 |
37 MESSAGE |
38 end |
39 |
40 failure_message_for_should_not do |actual| |
41 <<-MESSAGE |
42 |
43 expected not #{inspect_object(actual)} |
44 got #{inspect_object(_expected_)} |
45 |
46 Compared using equal?, which compares object identity. |
47 |
48 MESSAGE |
49 end |
50 end |
51 end |
52 end |
53 end |
Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8