Class: Mocha::ParameterMatchers::IsA

Inherits:
Base show all
Defined in:
lib/mocha/parameter_matchers/is_a.rb

Overview

Parameter matcher which matches when actual parameter is a specific class.

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(klass) ⇒ IsA


34
35
36
# File 'lib/mocha/parameter_matchers/is_a.rb', line 34

def initialize(klass)
  @klass = klass
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean


39
40
41
42
# File 'lib/mocha/parameter_matchers/is_a.rb', line 39

def matches?(available_parameters)
  parameter = available_parameters.shift
  parameter.is_a?(@klass)
end

#mocha_inspectObject


45
46
47
# File 'lib/mocha/parameter_matchers/is_a.rb', line 45

def mocha_inspect
  "is_a(#{@klass.mocha_inspect})"
end