Sha256: 10c0f4f488d2178a7747d9fe72dd86f34ec81ce46fa07ec778828a5d742f37be

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

require 'not_a_mock/matchers/call_matcher'

module NotAMock
  module Matchers
    # Matcher for
    #   object.should have_received(...)
    class MethodMatcher < CallMatcher
  
      def initialize(method, parent = nil)
        super parent
        @method = method
      end
  
      def matches_without_parents?
        @calls = CallRecorder.instance.calls_by_object_and_method(@object, @method)
        !@calls.empty?
      end
  
      def failure_message_without_parents
        if matched?
          " received #{@method}"
        else
          " didn't receive #{@method}"
        end
      end
  
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
not_a_mock-1.0.1 lib/not_a_mock/matchers/method_matcher.rb
not_a_mock-1.0.0 lib/not_a_mock/matchers/method_matcher.rb