Fix first-request capture for multi-call examples#370
Open
Kris-LIBIS wants to merge 1 commit into
Open
Conversation
| end | ||
|
|
||
| session = context.instance_variable_get(:@integration_session) | ||
| return [session.request, session.response] if session&.request && session&.response |
| @@ -0,0 +1,81 @@ | |||
| # frozen_string_literal: true | |||
|
|
|||
| module RSpec::OpenAPI::RequestRecorder | |||
|
|
||
| module RSpec::OpenAPI::RequestRecorder | ||
| THREAD_KEY = :rspec_openapi_first_exchange | ||
| VERBS = %i[get post put patch delete head options].freeze |
| THREAD_KEY = :rspec_openapi_first_exchange | ||
| VERBS = %i[get post put patch delete head options].freeze | ||
|
|
||
| module RackMethodsTracking |
| end | ||
| end | ||
|
|
||
| module RailsRunnerTracking |
| return if @installed | ||
|
|
||
| prepend_tracking_module(::Rack::Test::Methods, RackMethodsTracking) if defined?(::Rack::Test::Methods) | ||
| prepend_tracking_module(::ActionDispatch::Integration::Runner, RailsRunnerTracking) if defined?(::ActionDispatch::Integration::Runner) |
| expect(get_op.dig('responses', '404', 'description')).to eq('returns 404 when missing=true') | ||
|
|
||
| expect(delete_op['summary']).to eq('Delete multi request resource') | ||
| expect(delete_op.dig('responses', '200', 'description')).to eq('deletes resource and verifies it is gone with a follow-up GET') |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #370 +/- ##
==========================================
- Coverage 92.33% 91.32% -1.01%
==========================================
Files 23 24 +1
Lines 900 957 +57
Branches 179 193 +14
==========================================
+ Hits 831 874 +43
- Misses 14 20 +6
- Partials 55 63 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #371
This fixes OpenAPI generation for examples that make multiple requests against the same path.
Problem:
Fix:
Tests: