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

[Bug] Running File specs types the wrong path in the command line, is there a way to change the path? #46

Open
Kewee123 opened this issue Jun 1, 2022 · 2 comments

Comments

@Kewee123
Copy link

Kewee123 commented Jun 1, 2022

As above, so when it tries to run the spec file it can't find it.

@Korywon
Copy link

Korywon commented Jun 1, 2022

Having the same issue. My project is organized like this:

my-dumb-project
├ frontend
└ backend <- Rails project lives here
  ├ spec
  | └ feature_spec.rb
  └ Gemfile

If I were to run a spec, this is what I would get:

my-dumb-project
❯ bundle exec rspec backend/spec/feature_spec.rb:42
Could not locate Gemfile or .bundle/ directory

But if I cd into my backend directory in that same terminal, this is what I would get:

my-dumb-project
❯ cd backend

my-dumb-project/backend
❯ bundle exec rspec backend/spec/jobs/feature_spec.rb:42

An error occurred while loading ./backend/spec/feature_spec.rb.
Failure/Error: __send__(method, file)

LoadError:
  cannot load such file -- /Users/foobar/projects/my-dumb-project/backend/backend/spec/feature_spec.rb

Interesting how it slaps on another backend to the path when I change it. The solution (albeit, not the greatest) is to open another VS Code on that backend directory as its root.

@valter0ff
Copy link

I found a solution. You need to open your backend folder as main in your Workspace - File -> Open folder. After that click File -> Add folder to Workspace and choose your my-dumb-project folder. Now you can run RSpec from opened file by pressing Ctrl+CMD+T or by right click on spec file from side panel.

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

No branches or pull requests

3 participants