Sha256: 4f6218a92d1d355cd0cd6f7d8f09079f64bd4c0a69182795435162fdd5351198

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

module Fakes
  module ArgBehaviour
    attr_accessor :return_value,:times_called

    def and_return(item)
      @return_value = item
    end

    def throws(exception)
      @exception = exception
    end

    def capture_args(args)
      @times_called += 1
      @called_args = args
    end

    def matches?(args)
      return @args == args
    end

    def was_called_with?(args)
      return @called_args == args
    end

    def process
      return @return_value unless @exception
      if @exception
        raise @exception
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fakes-0.2.3 lib/core/arg_behaviour.rb