method

matches?

Importance_0
matches?(collection_owner) public

No documentation

This method has no description. You can help the RSpec community by adding new notes.

Hide source
# File lib/spec/matchers/have.rb, line 19
      def matches?(collection_owner)
        if collection_owner.respond_to?(@collection_name)
          collection = collection_owner.__send__(@collection_name, *@args, &@block)
        elsif (@plural_collection_name && collection_owner.respond_to?(@plural_collection_name))
          collection = collection_owner.__send__(@plural_collection_name, *@args, &@block)
        elsif (collection_owner.respond_to?(:length) || collection_owner.respond_to?(:size))
          collection = collection_owner
        else
          collection_owner.__send__(@collection_name, *@args, &@block)
        end
        @actual = collection.size if collection.respond_to?(:size)
        @actual = collection.length if collection.respond_to?(:length)
        raise not_a_collection if @actual.nil?
        return @actual >= @expected if @relativity == :at_least
        return @actual <= @expected if @relativity == :at_most
        return @actual == @expected
      end
Register or log in to add new notes.