Sha256: 17d613483af572a11a19e360978821393d04d35ea6cfcc48da85d7d7c4c7f328

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

module Defekt
  class Mock
    def expect(methot, value, arguments=[])
      expected_calls.push([methot, arguments])

      define_singleton_method(methot) do |*args|
        actual_calls.push([methot, args])
        value
      end

      self
    end

    def verify
      expected_calls.uniq.sort == actual_calls.uniq.sort
    end

    private

    def expected_calls
      @expected_calls ||= []
    end

    def actual_calls
      @actual_calls ||= []
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
defekt-0.0.7 lib/defekt/mock.rb
defekt-0.0.6 lib/defekt/mock.rb
defekt-0.0.5 lib/defekt/mock.rb