Rspec Steps C0 Coverage Information - RCov

rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/extensions/instance_eval_with_args.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/extensions/instance_eval_with_args.rb 39 26
25.64%
19.23%

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 Core
3     module Extensions
4       module InstanceEvalWithArgs
5         # based on Bounded Spec InstanceExec (Mauricio Fernandez)
6         # http://eigenclass.org/hiki/bounded+space+instance_exec
7         # - uses singleton_class instead of global InstanceExecHelper module
8         # - this keeps it scoped to classes/modules that include this module
9         # - only necessary for ruby 1.8.6
10         def instance_eval_with_args(*args, &block)
11           return instance_exec(*args, &block) if respond_to?(:instance_exec)
12 
13           # If there are no args and the block doesn't expect any, there's no
14           # need to fake instance_exec with our hack below.
15           # Notes:
16           #   * lambda { }.arity # => -1
17           #   * lambda { || }.arity # => 0
18           #   * lambda { |*a| }.arity # -1
19           return instance_eval(&block) if block.arity < 1 && args.size.zero?
20 
21           singleton_class = (class << self; self; end)
22           begin
23             orig_critical, Thread.critical = Thread.critical, true
24             n = 0
25             n += 1 while respond_to?(method_name="__instance_exec#{n}")
26             singleton_class.module_eval{ define_method(method_name, &block) }
27           ensure
28             Thread.critical = orig_critical
29           end
30           begin
31             return send(method_name, *args)
32           ensure
33             singleton_class.module_eval{ remove_method(method_name) } rescue nil
34           end
35         end
36       end
37     end
38   end
39 end

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