summaryrefslogtreecommitdiffstats
path: root/test/lib/mocha/parameter_matchers/anything.rb
blob: 57d0eeab4bb6efe18d283be36676ac21eaf164ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Mocha
  
  module ParameterMatchers

    # :call-seq: anything -> parameter_matcher
    #
    # Matches any object.
    #   object = mock()
    #   object.expects(:method_1).with(anything)
    #   object.method_1('foo')
    #   # no error raised
    def anything
      Anything.new
    end
    
    class Anything # :nodoc:
    
      def ==(parameter)
        return true
      end
      
      def mocha_inspect
        "anything"
      end
      
    end
    
  end
  
end