diff --git a/spec/type_checker/levels/strict_spec.rb b/spec/type_checker/levels/strict_spec.rb index 22bbd3631..c3ef2301f 100644 --- a/spec/type_checker/levels/strict_spec.rb +++ b/spec/type_checker/levels/strict_spec.rb @@ -376,6 +376,53 @@ def bar(baz) expect(checker.problems.first.message).to include('Not enough arguments') end + it 'reports solo missing kwarg' do + checker = type_checker(%( + class Foo + def bar(baz:) + end + end + Foo.new.bar + )) + expect(checker.problems).to be_one + expect(checker.problems.first.message).to include('Missing keyword arguments') + end + + it 'reports not enough kwargs' do + checker = type_checker(%( + class Foo + def bar(foo:, baz:) + end + end + Foo.new.bar(foo: 100) + )) + expect(checker.problems).to be_one + expect(checker.problems.first.message).to include('Missing keyword argument') + expect(checker.problems.first.message).to include('baz') + end + + it 'accepts passed kwargs' do + checker = type_checker(%( + class Foo + def bar(baz:) + end + end + Foo.new.bar(baz: 123) + )) + expect(checker.problems).to be_empty + end + + it 'accepts multiple passed kwargs' do + checker = type_checker(%( + class Foo + def bar(baz:, bing:) + end + end + Foo.new.bar(baz: 123, bing: 456) + )) + expect(checker.problems).to be_empty + end + it 'requires strict return tags' do checker = type_checker(%( class Foo