Class: Spec::Runner::HeckleRunner

Class | Spec::Runner::HeckleRunner
In: | lib/spec/runner/heckle_runner.rb lib/spec/runner/heckle_runner_unsupported.rb
Parent: | Object

Dummy implementation for Windows that just fails (Heckle is not supported on Windows)

### Methods

heckle_class_or_module heckle_method heckle_with new new verify_constant

### Public Class methods

new(filter, heckle_class=Heckler)

[Source]

        # File lib/spec/runner/heckle_runner.rb, line 11
    11:       def initialize(filter, heckle_class=Heckler)
    12:         @filter = filter
    13:         @heckle_class = heckle_class
    14:       end

new(filter)

[Source]

       # File lib/spec/runner/heckle_runner_unsupported.rb, line 5
    5:       def initialize(filter)
    6:         raise "Heckle not supported on Windows"
    7:       end

### Public Instance methods

heckle_class_or_module(class_or_module_name)

[Source]

        # File lib/spec/runner/heckle_runner.rb, line 32
    32:       def heckle_class_or_module(class_or_module_name)
    33:         verify_constant(class_or_module_name)
    34:         pattern = /^#{class_or_module_name}/
    35:         classes = []
    36:         ObjectSpace.each_object(Class) do |klass|
    37:           classes << klass if klass.name =~ pattern
    38:         end
    39:
    40:         classes.each do |klass|
    41:           klass.instance_methods(false).each do |method_name|
    42:             heckle = @heckle_class.new(klass.name, method_name, rspec_options)
    43:             heckle.validate
    44:           end
    45:         end
    46:       end

heckle_method(class_name, method_name)

[Source]

        # File lib/spec/runner/heckle_runner.rb, line 26
    26:       def heckle_method(class_name, method_name)
    27:         verify_constant(class_name)
    28:         heckle = @heckle_class.new(class_name, method_name, rspec_options)
    29:         heckle.validate
    30:       end

heckle_with()

Runs all the example groups held by `rspec_options` once for each of the methods in the matched classes.

[Source]

        # File lib/spec/runner/heckle_runner.rb, line 18
    18:       def heckle_with
    19:         if @filter =~ /(.*)[#\.](.*)/
    20:           heckle_method($1, $2)
    21:         else
    22:           heckle_class_or_module(@filter)
    23:         end
    24:       end

verify_constant(name)

[Source]

        # File lib/spec/runner/heckle_runner.rb, line 48
    48:       def verify_constant(name)
    49:         begin
    50:           # This is defined in Heckle
    51:           name.to_class
    52:         rescue
    53:           raise "Heckling failed - \"#{name}\" is not a known class or module"
    54:         end
    55:       end

[Validate]