Rspec Steps C0 Coverage Information - RCov

rcov/ruby/1.8/gems/rspec-expectations-2.5.0/lib/rspec/matchers/be_within.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
rcov/ruby/1.8/gems/rspec-expectations-2.5.0/lib/rspec/matchers/be_within.rb 40 26
32.50%
11.54%

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 RSpec
2   module Matchers
3     # :call-seq:
4     #   should be_within(delta).of(expected)
5     #   should_not be_within(delta).of(expected)
6     #
7     # Passes if actual == expected +/- delta
8     #
9     # == Example
10     #
11     #   result.should be_within(0.5).of(3.0)
12     def be_within(delta)
13       Matcher.new :be_within, delta do |_delta_|
14         chain :of do |_expected_|
15           @_expected = _expected_
16         end
17 
18         match do |actual|
19           unless @_expected
20             raise ArgumentError.new("You must set an expected value using #of: be_within(#{_delta_}).of(expected_value)")
21           end
22           (actual - @_expected).abs < _delta_
23         end
24 
25         failure_message_for_should do |actual|
26           "expected #{actual} to #{description}"
27         end
28 
29         failure_message_for_should_not do |actual|
30           "expected #{actual} not to #{description}"
31         end
32 
33         description do
34           "be within #{_delta_} of #{@_expected}"
35         end
36       end
37     end
38   end
39 end
40 

Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8