@@ -343,5 +343,57 @@ def some_update; end
343343 end
344344 CODE
345345 end
346+
347+ def test_kwargs
348+ assert_invalid_workflow_code 'Workflow execute cannot have keyword arguments' , <<~CODE
349+ class TestExecuteKeywordArgs < Temporalio::Workflow::Definition
350+ def execute(foo, bar:)
351+ end
352+ end
353+ CODE
354+ assert_invalid_workflow_code 'Workflow init cannot have keyword arguments' , <<~CODE
355+ class TestInitKeywordArgs < Temporalio::Workflow::Definition
356+ workflow_init
357+ def initialize(foo, bar:); end
358+
359+ def execute; end
360+ end
361+ CODE
362+ assert_invalid_workflow_code 'Workflow signal cannot have keyword arguments' , <<~CODE
363+ class TestSignalKeywordArgs < Temporalio::Workflow::Definition
364+ def execute; end
365+
366+ workflow_signal
367+ def some_handler(foo, bar: 'baz'); end
368+ end
369+ CODE
370+ assert_invalid_workflow_code 'Workflow query cannot have keyword arguments' , <<~CODE
371+ class TestQueryKeywordArgs < Temporalio::Workflow::Definition
372+ def execute; end
373+
374+ workflow_query
375+ def some_handler(foo, bar:); end
376+ end
377+ CODE
378+ assert_invalid_workflow_code 'Workflow update cannot have keyword arguments' , <<~CODE
379+ class TestUpdateKeywordArgs < Temporalio::Workflow::Definition
380+ def execute; end
381+
382+ workflow_update
383+ def some_handler(foo, bar:); end
384+ end
385+ CODE
386+ assert_invalid_workflow_code 'Workflow update_validator cannot have keyword arguments' , <<~CODE
387+ class TestUpdateValidatorKeywordArgs < Temporalio::Workflow::Definition
388+ def execute; end
389+
390+ workflow_update_validator(:some_handler)
391+ def validate_some_handler(foo, bar:); end
392+
393+ workflow_update
394+ def some_handler(foo, bar:); end
395+ end
396+ CODE
397+ end
346398 end
347399end
0 commit comments