Decouple Ruby tests from specific machine setup#4088
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
| "3.3.5", | ||
| "~/.gem/ruby/3.3.5,/opt/rubies/3.3.5/lib/ruby/gems/3.3.0", |
There was a problem hiding this comment.
I noticed some of the values are repeated, could they be constants? Or defaults as part of a helper function?
st0012
left a comment
There was a problem hiding this comment.
Review assisted by pair-review
| } | ||
| return defaultValue === undefined ? real.get(key) : real.get(key, defaultValue); | ||
| }, | ||
| has: real.has.bind(real), |
There was a problem hiding this comment.
Do we want to make sure has behave the same way get does to prevent mismatching results in the future?
| return undefined; | ||
| stubWorkspaceConfiguration(sandbox, { | ||
| rubyLsp: { | ||
| rubyVersionManager: { identifier: ManagerIdentifier.Rbenv }, |
There was a problem hiding this comment.
Does this stub out the rbenvExecutablePath config test runner may have?

Motivation
Another step towards #2877
Our Ruby test was also coupled with specific machine setups and was in fact failing locally due to recent changes. This PR decouples the test from specific setups, so that contributors (and our own team) can always run these.
Implementation
I extracted a better helper for stubbing VS Code settings since this is repeated pattern in our tests. Then refactored the Ruby activation tests to verify logic with stubs rather than shelling out.