Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Heckle requires "self.$method_name" for class methods

- Closes #2.
  • Loading branch information...
commit 40e737dac4198f2fc489656206146a5c069edfe6 1 parent 09c2416
@dkubb dkubb authored committed
View
9 lib/spec/runner/heckle_runner.rb
@@ -17,12 +17,17 @@ def initialize(filter, heckle_class=Heckler)
# Runs all the example groups held by +rspec_options+ once for each of the
# methods in the matched classes.
def heckle_with
- if @filter =~ /(.*)[#\.](.*)/
- heckle_method($1, $2)
+ case @filter
+ when /(.*)#(.*)/ then heckle_method($1, $2)
+ when /(.*)\.(.*)/ then heckle_class_method($1, $2)
else
heckle_class_or_module(@filter)
end
end
+
+ def heckle_class_method(class_name, method_name)
+ heckle_method(class_name, "self.#{method_name}")
+ end
def heckle_method(class_name, method_name)
verify_constant(class_name)
View
2  spec/spec/runner/heckle_runner_spec.rb
@@ -53,7 +53,7 @@ def four; end
end
it "should heckle specific method in a class (with .)" do
- @heckle_class.should_receive(:new).with("Foo::Bar", "two", Spec::Runner.options).and_return(@heckle)
+ @heckle_class.should_receive(:new).with("Foo::Bar", "self.two", Spec::Runner.options).and_return(@heckle)
heckle_runner = Spec::Runner::HeckleRunner.new("Foo::Bar.two", @heckle_class)
heckle_runner.heckle_with
Please sign in to comment.
Something went wrong with that request. Please try again.