lib/rspec/sleeping_king_studios/matchers/shared/match_parameters.rb
# Adds a parameter count expectation and/or one or more keyword
# expectations.
#
# @overload with count
#   Adds a parameter count expectation.
#
#   @param [Integer, Range, nil] count (optional) The number of expected
#     parameters.
#
#   @return [RespondToMatcher] self
# @overload with *keywords
#   Adds one or more keyword expectations.
#
#   @param [Array<String, Symbol>] keywords List of keyword arguments
#     accepted by the method.
#
#   @return self
# @overload with count, *keywords
#   Adds a parameter count expectation and one or more keyword
#   expectations.
#
#   @param [Integer, Range, nil] count (optional) The number of expected
#     parameters.
#   @param [Array<String, Symbol>] keywords List of keyword arguments
#     accepted by the method.
#
#   @return self
Adds a parameter count expectation and/or one or more keyword
expectations.
Adds a parameter count expectation and / or one or more keyword expectations .
def with *keywords
      case keywords.first
      when Range
        arity = keywords.shift
        method_signature_expectation.min_arguments = arity.begin
        method_signature_expectation.max_arguments = arity.end
      when Integer
        arity = keywords.shift
        method_signature_expectation.min_arguments = arity
        method_signature_expectation.max_arguments = arity
      end 
      method_signature_expectation.keywords = keywords
      self
    end
def with * keywords case keywords . first when Range arity = keywords . shift method_signature_expectation . min_arguments = arity . begin method_signature_expectation . max_arguments = arity . end when Integer arity = keywords . shift method_signature_expectation . min_arguments = arity method_signature_expectation . max_arguments = arity end method_signature_expectation . keywords = keywords self end
Adds a parameter count expectation and/or one or more keyword
expectations.
Adds a parameter count expectation and / or one or more keyword expectations .
# case
keywords
<not_specific>
overload
with count Adds a parameter count expectation. @param [Integer, Range, nil] count (optional) The number of expected parameters. @return [RespondToMatcher] self
with count Adds a parameter count expectation . @param [ Integer Range nil ] count ( optional ) The number of expected parameters . @return [ RespondToMatcher ] self
overload
with *keywords Adds one or more keyword expectations. @param [Array] keywords List of keyword arguments accepted by the method. @return self
with * keywords Adds one or more keyword expectations . @param [ Array ] keywords List of keyword arguments accepted by the method . @return self
overload
with count, *keywords Adds a parameter count expectation and one or more keyword expectations. @param [Integer, Range, nil] count (optional) The number of expected parameters. @param [Array] keywords List of keyword arguments accepted by the method. @return self
with count * keywords Adds a parameter count expectation and one or more keyword expectations . @param [ Integer Range nil ] count ( optional ) The number of expected parameters . @param [ Array ] keywords List of keyword arguments accepted by the method . @return self