feat(ruby): improve wire test generation with client reuse and AST-level snippet handling #11078
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Linear ticket: Closes FER-7955
Implements three improvements to Ruby SDK wire test generation:
setupmethod and stored in@client, following the PHP/Python pattern for better performanceskipClientInstantiationoptionWireMockTestCasebase class (following PHP/Python pattern), reducing code duplication across test filesLink to Devin run: https://app.devin.ai/sessions/6e5c0237738043a1b60de9c92fdae6e1
Requested by: [email protected] (@iamnamananand996)
Changes Made
skipClientInstantiationoption toEndpointSnippetGeneratorthat generates method calls on existing@clientinstance variableDynamicSnippetsGenerator.generateSnippetAstto accept and pass through optionsWireTestGeneratorto:setupmethod that creates@clientwith auth and base_urlsnippetAstinstead of string snippets in test casesprocessSnippetForWireMock,injectAuthIntoSnippet,injectBaseUrlIntoRequestOptions, etc.)WireMockTestCaseinstead ofMinitest::TestWireTestSetupGeneratorto generatewiremock_test_case.rbbase class containing:WIREMOCK_BASE_URLandWIREMOCK_ADMIN_URLconstantsverify_request_counthelper methodTesting
pnpm run check)pnpm compile)exhaustiveandexamplesfixtures with wire-tests enabledWireMockTestCasecorrectlyHuman Review Checklist
WireMockTestCasebase class is generated with correct Ruby syntax and documentationrequire_relative "wiremock_test_case"and inherit fromWireMockTestCase