123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Support::MethodSignatureExpectation Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-support/lib/rspec/support/method_signature_verifier.rb

Overview

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

Class Method Summary

Instance Attribute Summary

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

  
# 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

#expect_arbitrary_keywords (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 231

attr_accessor :expect_unlimited_arguments, :expect_arbitrary_keywords

#expect_unlimited_arguments (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 231

attr_accessor :expect_unlimited_arguments, :expect_arbitrary_keywords

#keywords (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 229

attr_reader :min_count, :max_count, :keywords

#keywords=(values) (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 254

def keywords=(values)
  @keywords = values.to_a || []
end

#max_count (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 229

attr_reader :min_count, :max_count, :keywords

#max_count=(number) (rw)

Raises:

  • (ArgumentError)
[ GitHub ]

  
# 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

#min_count (rw)

[ GitHub ]

  
# File 'rspec-support/lib/rspec/support/method_signature_verifier.rb', line 229

attr_reader :min_count, :max_count, :keywords

#min_count=(number) (rw)

Raises:

  • (ArgumentError)
[ GitHub ]

  
# 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