Sha256: d2855d290cd9164c1bff87b83742605178b2c2682409672d6a9177f6d284d2f0

Contents?: true

Size: 1.12 KB

Versions: 14

Compression:

Stored size: 1.12 KB

Contents

#!/usr/bin/env ruby

#---
# Copyright 2003, 2004, 2005, 2006, 2007 by Jim Weirich (jim@weirichhouse.org).
# All rights reserved.

# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#+++

require 'flexmock/argument_matchers'

class FlexMock

  ####################################################################
  # Include this module in your test class if you wish to use the +eq+
  # and +any+ argument matching methods without a prefix.  (Otherwise
  # use <tt>FlexMock.any</tt> and <tt>FlexMock.eq(obj)</tt>.
  #
  module ArgumentTypes
    # Return an argument matcher that matches any argument.
    def any
      ANY
    end

    # Return an argument matcher that only matches things equal to
    # (==) the given object.
    def eq(obj)
      EqualMatcher.new(obj)
    end

    # Return an argument matcher that matches any object, that when
    # passed to the supplied block, will cause the block to return
    # true.
    def on(&block)
      ProcMatcher.new(&block)
    end
  end
  extend ArgumentTypes

end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
flexmock-0.6.2 lib/flexmock/argument_types.rb
flexmock-0.6.3 lib/flexmock/argument_types.rb
flexmock-0.8.0 lib/flexmock/argument_types.rb
flexmock-0.6.0 lib/flexmock/argument_types.rb
flexmock-0.6.4 lib/flexmock/argument_types.rb
flexmock-0.7.0 lib/flexmock/argument_types.rb
flexmock-0.7.1 lib/flexmock/argument_types.rb
flexmock-0.8.1 lib/flexmock/argument_types.rb
flexmock-0.6.1 lib/flexmock/argument_types.rb
flexmock-0.8.2 lib/flexmock/argument_types.rb
flexmock-0.8.3 lib/flexmock/argument_types.rb
mack-0.8.2 lib/gems/flexmock-0.8.3/lib/flexmock/argument_types.rb
mack-0.8.3.1 lib/gems/flexmock-0.8.3/lib/flexmock/argument_types.rb
mack-0.8.3 lib/gems/flexmock-0.8.3/lib/flexmock/argument_types.rb