stirhoss · 2022-03-31 16:02
Hello, I am new to emacs (and develepment in general) but I am really enjoying the workflow. One of the issue I have been having though is that I can't get rspec to run inside of emacs. I think that it is something wrong with my terminal config but I can't figure it out and there doesn't seem to be much documentation on the issue.
[here is the error.](https://preview.redd.it/i46kkxyesqq81.png?width=1019&format=png&auto=webp&s=407b72e942e06a11074541674cacafc450c86560)
​
Let me know if there is any other information that is needed to understand the issue. Much appreciation!
myme · 2022-03-31 16:23
Good choice of components: running rspec from emacs with rspec-mode frequently is a part of my workflow which I find most satisfying.
The error message tells you what it tries to run, and in which directory. `erroneous_creatures` looks like the root of a project, so that is probably correct. From there, it tries to run the plain executable `rspec`. This may work outside of emacs in a terminal, but if so the reason is that the PATH is set up differently.
`rspec-mode` opens a buffer in `compilation-mode` to run the spec – that's the buffer where you see the error message. In there, you can type `C-u g`, which should prompt you for another command to run, with the one that ran before prefilled in as default. You can experiment with that, even put in a totally different command. I would suggest to try `ruby -v` at first to see if it's using the correct ruby version at all. If it does, try `bundle exec rspec` or `bin/rspec`.
Please post whether that looks like it works, or if not what the errors are, then we can continue from there.
stirhoss · 2022-03-31 17:18
C-u g just returns g is undefined?
stirhoss · 2022-03-31 17:50
what it looks like when I try C-u g:
​
https://capture.dropbox.com/qRQe9uBODjZuI5P6
myme · 2022-03-31 21:45
Interesting. On my emacs `g` is bound to the command `compile`. Can you execute that command directly, including the `C-u` prefix? So you would need to type: `C-u M-x compile [RET]`.
To find out about the mode that a buffer is in, you can always type `C-h m`. This will show a short description of the major mode and its keybindings, followed by the same for all minor modes.
PuercoPop · 2022-04-01 01:56
It seems Emacs can't find rspec on its path. Path issues are common in Mac OS. What happens if you do M-x eshell rspec?
I use chruby.el to make sure that the right ruby version is in the path. And then bundler to make sure the gems are loaded. rspec wil use bundler out of the box if it finds it.