Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace the ruby version in env path #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bjelline
Copy link

This is a first draft for a fix.
I ran into trouble with ruby test adapter using the wrong ruby version.

which version should it be using?

  • either the ruby version from rvm,
  • or the ruby version configured in vs code under ruby.interpreter.commandPath

this patch manipulates the environment variables PATH, GEM_PATH and GEM_HOME:
it replaces the ruby-version used there with the version from vs code ruby.interpreter.commandPath

only tested on macos, one rails project with minitest, ruby 2.6.6
this is not ready to be merged!

I hope to spark a discussion of how to fix this problem properly

… with the ruby version configured in the vscode ruby extension
@connorshea
Copy link
Owner

Interesting, I use rbenv and I haven't noticed any problems like this. I was under the impression it would just use whatever was set for the given repository (either via .ruby-version or the Gemfile) since it's running tests from the repo.

I believe you might be confusing the ruby.interpreter.commandPath as coming from this repo, when it's actually defined by the VS Code Ruby extension, which isn't a dependency of this extension. I'd rather rely on the behavior of the user's ruby version manager (rbenv, rvm, etc.) than implement custom logic like this in the extension.

@quoyi
Copy link

quoyi commented Jan 18, 2021

.ruby-version and ruby.interpreter.commandPath not working.
projectA used ruby 2.6.6, projectB used ruby 2.7.2 will error validate_ruby!': Your Ruby version is 2.6.6, but your Gemfile specified 2.7.2 (Bundler::RubyVersionMismatch)...

@AntonDiachuk
Copy link

"rubyTestExplorer.rspecCommand": "rvm use 2.5.0@vault do ./bin/rspec" works for me but I agree with topicstarter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants