Module: RR::DoubleDefinitions::DoubleDefinition::StateQueryMethods

Included in:
RR::DoubleDefinitions::DoubleDefinition
Defined in:
lib/rr/double_definitions/double_definition.rb

Instance Method Summary collapse

Instance Method Details

#exact_match?(arguments, keyword_arguments) ⇒ Boolean

Returns:

  • (Boolean)


312
313
314
315
316
317
# File 'lib/rr/double_definitions/double_definition.rb', line 312

def exact_match?(arguments, keyword_arguments)
  unless @argument_expectation
    raise RR::Errors.build_error(:DoubleDefinitionError, "#argument_expectation must be defined on #{inspect}")
  end
  @argument_expectation.exact_match?(arguments, keyword_arguments)
end

#expected_argumentsObject



333
334
335
336
337
338
339
# File 'lib/rr/double_definitions/double_definition.rb', line 333

def expected_arguments
  if argument_expectation
    argument_expectation.expected_arguments
  else
    []
  end
end

#expected_keyword_argumentsObject



341
342
343
344
345
346
347
# File 'lib/rr/double_definitions/double_definition.rb', line 341

def expected_keyword_arguments
  if argument_expectation
    argument_expectation.expected_keyword_arguments
  else
    {}
  end
end

#implementation_is_original_method?Boolean

Returns:

  • (Boolean)


349
350
351
# File 'lib/rr/double_definitions/double_definition.rb', line 349

def implementation_is_original_method?
  implementation_strategy.is_a?(Strategies::Implementation::Proxy)
end

#ordered?Boolean

Double#ordered? returns true when the Double is ordered.

mock(subject).method_name.ordered?

Returns:

  • (Boolean)


302
303
304
# File 'lib/rr/double_definitions/double_definition.rb', line 302

def ordered?
  @ordered
end

#terminal?Boolean

Returns:

  • (Boolean)


326
327
328
329
330
331
# File 'lib/rr/double_definitions/double_definition.rb', line 326

def terminal?
  unless @times_matcher
    raise RR::Errors.build_error(:DoubleDefinitionError, "#argument_expectation must be defined on #{inspect}")
  end
  @times_matcher.terminal?
end

#verbose?Boolean

Double#verbose? returns true when verbose has been called on it. It returns true when the double is set to print each method call it receives.

Returns:

  • (Boolean)


308
309
310
# File 'lib/rr/double_definitions/double_definition.rb', line 308

def verbose?
  @verbose ? true : false
end

#verify_method_signature?Boolean Also known as: strong?

Returns:

  • (Boolean)


353
354
355
# File 'lib/rr/double_definitions/double_definition.rb', line 353

def verify_method_signature?
  !!@verify_method_signature
end

#wildcard_match?(arguments, keyword_arguments) ⇒ Boolean

Returns:

  • (Boolean)


319
320
321
322
323
324
# File 'lib/rr/double_definitions/double_definition.rb', line 319

def wildcard_match?(arguments, keyword_arguments)
  unless @argument_expectation
    raise RR::Errors.build_error(:DoubleDefinitionError, "#argument_expectation must be defined on #{inspect}")
  end
  @argument_expectation.wildcard_match?(arguments, keyword_arguments)
end