Class Spec::Runner::HeckleRunner

  1. lib/spec/runner/heckle_runner.rb
  2. lib/spec/runner/heckle_runner_unsupported.rb
  3. show all
Parent: Object

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

Public class methods

new (filter, heckle_class=Heckler)
[show source]
# File lib/spec/runner/heckle_runner.rb, line 11
        def initialize(filter, heckle_class=Heckler)
          @filter = filter
          @heckle_class = heckle_class
        end
new (filter)
[show source]
# File lib/spec/runner/heckle_runner_unsupported.rb, line 5
      def initialize(filter)
        raise "Heckle is not supported on Windows or Ruby 1.9"
      end

Public instance methods

heckle_class_or_module (class_or_module_name)
[show source]
# 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.options)
              heckle.validate
            end
          end
        end
heckle_method (class_name, method_name)
[show source]
# 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.options)
          heckle.validate
        end
heckle_with ()

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

[show source]
# 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)
[show source]
# 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