Skip to content

Commit

Permalink
method_missing is private
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Nov 25, 2010
1 parent 831403a commit 9571f5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/rspec/matchers/have.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def respond_to?(sym)


private private


def method_missing(sym, *args, &block) def method_missing(method, *args, &block)
@collection_name = sym @collection_name = method
if inflector = (defined?(ActiveSupport::Inflector) && ActiveSupport::Inflector.respond_to?(:pluralize) ? ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil)) if inflector = (defined?(ActiveSupport::Inflector) && ActiveSupport::Inflector.respond_to?(:pluralize) ? ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil))
@plural_collection_name = inflector.pluralize(sym.to_s) @plural_collection_name = inflector.pluralize(method.to_s)
end end
@args = args @args = args
@block = block @block = block
Expand Down
8 changes: 4 additions & 4 deletions lib/rspec/matchers/matcher.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def chain(method, &block)


private private


def method_missing(name, *args, &block) def method_missing(method, *args, &block)
if $matcher_execution_context.respond_to?(name) if $matcher_execution_context.respond_to?(method)
$matcher_execution_context.send name, *args, &block $matcher_execution_context.send method, *args, &block
else else
super(name, *args, &block) super(method, *args, &block)
end end
end end


Expand Down
9 changes: 6 additions & 3 deletions lib/rspec/matchers/method_missing.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,11 @@
module RSpec module RSpec
module Matchers module Matchers
def method_missing(sym, *args, &block) # :nodoc:
return Matchers::BePredicate.new(sym, *args, &block) if sym.to_s =~ /^be_/ private
return Matchers::Has.new(sym, *args, &block) if sym.to_s =~ /^have_/
def method_missing(method, *args, &block) # :nodoc:
return Matchers::BePredicate.new(method, *args, &block) if method.to_s =~ /^be_/
return Matchers::Has.new(method, *args, &block) if method.to_s =~ /^have_/
super super
end end
end end
Expand Down

0 comments on commit 9571f5c

Please sign in to comment.