Parent

Class/Module Index [+]

Quicksearch

Spec::Runner::HeckleRunner

Creates a new Heckler configured to heckle all methods in the classes whose name matches filter


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

Public Class Methods

new(filter, heckle_class=Heckler) click to toggle source
# File lib/spec/runner/heckle_runner.rb, line 12
def initialize(filter, heckle_class=Heckler)
  @filter = filter
  @heckle_class = heckle_class
end

Public Instance Methods

heckle_class_or_module(class_or_module_name) click to toggle source
# File lib/spec/runner/heckle_runner.rb, line 33
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) click to toggle source
# File lib/spec/runner/heckle_runner.rb, line 27
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() click to toggle source

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

# File lib/spec/runner/heckle_runner.rb, line 19
def heckle_with
  if @filter =~ /(.*)[#\.](.*)/
    heckle_method($1, $2)
  else
    heckle_class_or_module(@filter)
  end
end
verify_constant(name) click to toggle source
# File lib/spec/runner/heckle_runner.rb, line 49
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.