Rspec Steps C0 Coverage Information - RCov

rcov/ruby/1.8/gems/rspec-core-2.5.1/lib/rspec/core/extensions/module_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/module_eval_with_args.rb 34 16
20.59%
37.50%

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 ModuleEvalWithArgs
5         include InstanceEvalWithArgs
6 
7         def module_eval_with_args(*args, &block)
8           # ruby > 1.8.6
9           return module_exec(*args, &block) if respond_to?(:module_exec)
10 
11           # If there are no args and the block doesn't expect any, there's no
12           # need to fake module_exec with our hack below.
13           # Notes:
14           #   * lambda {      }.arity # => -1
15           #   * lambda { ||   }.arity # =>  0
16           #   * lambda { |*a| }.arity # => -1
17           return module_eval(&block) if block.arity < 1 && args.size.zero?
18 
19           orig_singleton_methods = singleton_methods
20           instance_eval_with_args(*args, &block)
21 
22           # The only difference between instance_eval and module_eval is static method defs.
23           #   * `def foo` in instance_eval defines a singleton method on the instance
24           #   * `def foo` in class/module_eval defines an instance method for the class/module
25           # Here we deal with this difference by defining an instance method for
26           # each new singleton method.
27           # This has the side effect of duplicating methods (all new class methods will
28           # become instance methods and vice versa), but I don't see a way around it...
29           (singleton_methods - orig_singleton_methods).each { |m| define_method(m, &method(m)) }
30         end
31       end
32     end
33   end
34 end

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