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 201
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 228
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 235
def keywords=(values)
  # until RSpec 4
  # rubocop:disable Lint/UselessOr
  @keywords = values.to_a || []
  # rubocop:enable Lint/UselessOr
end
# File rspec-support/lib/rspec/support/method_signature_verifier.rb, line 214
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 221
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