Class: RSpec::Support::MethodSignatureExpectation Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/support/method_signature_verifier.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodSignatureExpectation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MethodSignatureExpectation.



179
180
181
182
183
184
185
186
# File 'lib/rspec/support/method_signature_verifier.rb', line 179

def initialize
  @min_count = nil
  @max_count = nil
  @keywords  = []

  @expect_unlimited_arguments = false
  @expect_arbitrary_keywords  = false
end

Instance Attribute Details

#expect_arbitrary_keywordsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



190
191
192
# File 'lib/rspec/support/method_signature_verifier.rb', line 190

def expect_arbitrary_keywords
  @expect_arbitrary_keywords
end

#expect_unlimited_argumentsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



190
191
192
# File 'lib/rspec/support/method_signature_verifier.rb', line 190

def expect_unlimited_arguments
  @expect_unlimited_arguments
end

#keywordsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



188
189
190
# File 'lib/rspec/support/method_signature_verifier.rb', line 188

def keywords
  @keywords
end

#max_countObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



188
189
190
# File 'lib/rspec/support/method_signature_verifier.rb', line 188

def max_count
  @max_count
end

#min_countObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



188
189
190
# File 'lib/rspec/support/method_signature_verifier.rb', line 188

def min_count
  @min_count
end

Instance Method Details

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


206
207
208
209
210
211
# File 'lib/rspec/support/method_signature_verifier.rb', line 206

def empty?
  @min_count.nil? &&
    @keywords.to_a.empty? &&
    !@expect_arbitrary_keywords &&
    !@expect_unlimited_arguments
end