Sha256: ddc3df2f6c8b1847676c42aac1ee5ab56f70593fa95d3bec04f90ccbf0ce1208

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

require 'muack/definition'

module Muack
  class Modifier < Struct.new(:mock, :defi)
    # Public API
    def with_any_args
      defi.args = [WithAnyArgs]
      self
    end

    # Public API
    def times number
      if number >= 1
        (number - 1).times{ mock.__mock_defis_push(defi) }
      elsif number == 0
        mock.__mock_ignore(mock.__mock_defis_pop(defi))
      else
        raise "What would you expect from calling a method #{number} times?"
      end
      self
    end

    # Public API
    def object
      mock.object
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muack-0.5.0 lib/muack/modifier.rb