Module: DuckTyper::Minitest

Defined in:
lib/duck_typer/minitest.rb

Instance Method Summary collapse

Instance Method Details

#assert_canonical_interface_match(canonical, objects = nil, namespace: nil, type: :instance_methods, methods: nil, strict: false, name: nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/duck_typer/minitest.rb', line 18

def assert_canonical_interface_match(canonical, objects = nil, namespace: nil, type: :instance_methods, methods: nil, strict: false, name: nil)
  checker = CanonicalInterfaceChecker
    .new(objects, canonical:, namespace:, type:, methods:, strict:, name:)

  result = checker.call
  assert result.match?, result.failure_message
end

#assert_interfaces_match(objects = nil, namespace: nil, type: :instance_methods, methods: nil, strict: false, name: nil) ⇒ Object Also known as: assert_duck_types_match



7
8
9
10
11
12
13
14
# File 'lib/duck_typer/minitest.rb', line 7

def assert_interfaces_match(objects = nil, namespace: nil, type: :instance_methods, methods: nil, strict: false, name: nil)
  checker = BulkInterfaceChecker
    .new(objects, namespace:, type:, methods:, strict:, name:)

  checker.call do |result|
    assert result.match?, result.failure_message
  end
end