Skip to content

Commit 84d79ce

Browse files
thiagoaclaude
andcommitted
Test that each differing method appears once in failure_message
The diff array contains a method twice when it differs between sides (once from each set subtraction). `.uniq` prevents duplicate blocks in the output; this test pins that behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d73b40e commit 84d79ce

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/duck_typer/interface_checker_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,15 @@ def test_failure_message_includes_differing_method_signatures
439439
assert_includes message, "foo()"
440440
end
441441

442+
def test_failure_message_shows_each_differing_method_once
443+
left = Class.new { def foo(a) = nil }
444+
right = Class.new { def foo = nil }
445+
446+
message = call_checker(left, right).failure_message
447+
448+
assert_equal 1, message.scan("foo(a)").size
449+
end
450+
442451
def test_failure_message_shows_not_defined_for_missing_method
443452
left = Class.new { def foo = nil; def bar = nil }
444453
right = Class.new { def foo = nil }

0 commit comments

Comments
 (0)