Class: Mocha::ParameterMatchers::YamlEquivalent

Inherits:
Base
  • Object
show all
Defined in:
lib/mocha/parameter_matchers/yaml_equivalent.rb

Overview

Parameter matcher which matches if actual parameter is YAML equivalent of specified object.

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(object) ⇒ YamlEquivalent


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

def initialize(object)
  @object = object
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean


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

def matches?(available_parameters)
  parameter = available_parameters.shift
  @object == YAML.load(parameter)
end

#mocha_inspectObject


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

def mocha_inspect
  "yaml_equivalent(#{@object.mocha_inspect})"
end