class RSpec::Support::MethodSignatureExpectation

Encapsulates expectations about the number of arguments and allowed/required keyword args of a given method.

@api private

Attributes

Public Class Methods

# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 220
def initialize
  @min_count = nil
  @max_count = nil
  @keywords  = []

  @expect_unlimited_arguments = false
  @expect_arbitrary_keywords  = false
end

Public Instance Methods

# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 247
def empty?
  @min_count.nil? &&
    @keywords.to_a.empty? &&
    !@expect_arbitrary_keywords &&
    !@expect_unlimited_arguments
end
# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 254
def keywords=(values)
  @keywords = values.to_a || []
end
# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 233
def max_count=(number)
  raise ArgumentError, 'must be a non-negative integer or nil' \
    unless number.nil? || (number.is_a?(Integer) && number >= 0)

  @max_count = number
end
# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 240
def min_count=(number)
  raise ArgumentError, 'must be a non-negative integer or nil' \
    unless number.nil? || (number.is_a?(Integer) && number >= 0)

  @min_count = number
end