Method: Clowne::RSpec::Matchers::CloneAssociation#match

Defined in:
lib/clowne/rspec/clone_association.rb

#match(expected, _actual) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/clowne/rspec/clone_association.rb', line 23

def match(expected, _actual)
  @actual = plan.declarations
    .find { |key, decl| key == :association && decl.name == expected }

  return false if @actual.nil?

  @actual = actual.last

  AVAILABLE_PARAMS.each do |param|
    if expected_params[param] != UNDEFINED
      return false if expected_params[param] != actual.send(param)
    end
  end

  true
end