Permalink
Browse files

ask if the context supports the missing method

  • Loading branch information...
1 parent e9a9e46 commit 73262737fd1bdd6552da8a4327d3ff32f7e78439 @dchelimsky dchelimsky committed Mar 19, 2010
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/rspec/matchers/matcher.rb
  2. +1 −1 spec/rspec/matchers/matcher_spec.rb
@@ -90,9 +90,9 @@ def chain(method, &block)
private
def method_missing(name, *args, &block)
- begin
+ if $matcher_execution_context.respond_to?(name)
$matcher_execution_context.send name, *args, &block
- rescue NoMethodError
+ else
super(name, *args, &block)
end
end
@@ -308,7 +308,7 @@ def a_method_in_the_example
expect do
running_example.should __raise_no_method_error
- end.to raise_error(NoMethodError, /Rspec::Matchers::Matcher/)
+ end.to raise_error(/Rspec::Matchers::Matcher/)
end
end

0 comments on commit 7326273

Please sign in to comment.