chore(rails): improve test app setup #2762
Draft
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.
This fixes and simplifies test rails app setup for our
sentry-railstest suite. Previous solution suffered from too much duplication and global state pollution. I tried to stick to a regular Rails setup as much as possible here.In summary:
before(:suite)Sentry::TestRailsAppfrom a baseSentry:Rails:::Test::Applicationso that we can just leverage regular inheritance for version-specific tweaksmake_basic_appcalls - this causes issues as more global bloat is created (hence some specs were tweaked to not do this)make_basic_appto a dedicatedSentry::Rails::TestHelperthat gets included in all spec examplesThis makes the spec suite more stable and faster:
Notice that the suite gets slower and slower with each Rails version. This is because Rails accumulates more global state and there are still some leakages. We can keep improving it every time there's a chance. I'm gonna call it a day for now as it's already a huge improvement 😄
#skip-changelog