Displaying 1 result from an estimated 1 matches for "any_number".
Did you mean:
  a_number
  
2008 Mar 08
3
should_receive(:foo).with(any_object)
...:
class AnyObjectComparator
 attr_reader :object
 def ==(other)
   @object = other
   true
 end
end
class AnyNumberComparator <  AnyObjectComparator
 def ==(other)
   super.==(other)
   other.is_a?(Numeric)
 end
end
def any_object
 @any_object ||= AnyObjectComparator.new
 @any_object
end
def any_number
 @any_number ||= AnyNumberComparator.new
 @any_number
end
Which gives me the ability to do the should_receive call like this:
 Item.should_receive(:random_item).with(any_object,
any_number).at_least(1).times.and_return(mock_model(Item))
(the first any_object parameter is only in there for demons...