Class: Spec::Runner::HeckleRunner
- Defined in:
- lib/spec/runner/heckle_runner.rb,
lib/spec/runner/heckle_runner_unsupported.rb
Overview
Dummy implementation for Windows that just fails (Heckle is not supported on Windows)
Instance Method Summary collapse
- #heckle_class_or_module(class_or_module_name) ⇒ Object
- #heckle_method(class_name, method_name) ⇒ Object
-
#heckle_with ⇒ Object
Runs all the example groups held by
rspec_options
once for each of the methods in the matched classes. -
#initialize(filter) ⇒ HeckleRunner
constructor
A new instance of HeckleRunner.
- #verify_constant(name) ⇒ Object
Constructor Details
#initialize(filter) ⇒ HeckleRunner
Returns a new instance of HeckleRunner.
11 12 13 14 |
# File 'lib/spec/runner/heckle_runner.rb', line 11 def initialize(filter, heckle_class=Heckler) @filter = filter @heckle_class = heckle_class end |
Instance Method Details
#heckle_class_or_module(class_or_module_name) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/spec/runner/heckle_runner.rb', line 32 def heckle_class_or_module(class_or_module_name) verify_constant(class_or_module_name) pattern = /^#{class_or_module_name}/ classes = [] ObjectSpace.each_object(Class) do |klass| classes << klass if klass.name =~ pattern end classes.each do |klass| klass.instance_methods(false).each do |method_name| heckle = @heckle_class.new(klass.name, method_name, Spec::Runner.) heckle.validate end end end |
#heckle_method(class_name, method_name) ⇒ Object
26 27 28 29 30 |
# File 'lib/spec/runner/heckle_runner.rb', line 26 def heckle_method(class_name, method_name) verify_constant(class_name) heckle = @heckle_class.new(class_name, method_name, Spec::Runner.) heckle.validate end |
#heckle_with ⇒ Object
Runs all the example groups held by rspec_options
once for each of the methods in the matched classes.
18 19 20 21 22 23 24 |
# File 'lib/spec/runner/heckle_runner.rb', line 18 def heckle_with if @filter =~ /(.*)[#\.](.*)/ heckle_method($1, $2) else heckle_class_or_module(@filter) end end |
#verify_constant(name) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/spec/runner/heckle_runner.rb', line 48 def verify_constant(name) begin # This is defined in Heckle name.to_class rescue raise "Heckling failed - \"#{name}\" is not a known class or module" end end |