Class: Spec::Runner::HeckleRunner
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/runner/heckle_runner.rb,
lib/gems/rspec-1.1.12/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.
12 13 14 15 |
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/heckle_runner.rb', line 12 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
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gems/rspec-1.1.12/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.) heckle.validate end end end |
#heckle_method(class_name, method_name) ⇒ Object
27 28 29 30 31 |
# File 'lib/gems/rspec-1.1.12/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.) 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.
19 20 21 22 23 24 25 |
# File 'lib/gems/rspec-1.1.12/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) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/gems/rspec-1.1.12/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 |