Comments (9)
Found a fix, solution below:
Solution:
Within my .zshrc I had initialized rbenv with
# Within ~/.zshrc
# Setup rbenv shims, completion, and path
eval "$(rbenv init -)"
After moving this into my ~/.zshenv instead, restarting my shell, and restarting Spacemacs, rspec-mode found the correct Ruby version managed by rbenv and invoked the tests as expected.
# Within ~/.zshenv
## Default PATH foundation
PATH=/usr/local/bin:/usr/local/sbin:...lots-more-dirs-here...$PATH;
export PATH
# Setup rbenv shims, completion, and path
eval "$(rbenv init -)"
from rspec-mode.
Try https://github.com/purcell/exec-path-from-shell, maybe.
This problem is probably not rspec-mode-specific.
from rspec-mode.
@dgutov Yeah maybe that's possible, I just invoked RSpec from within a Dired buffer by using shell-command
with bin/rspec
and received
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/username/Dev/projects/project/bin/spring:8:in `<top (required)>'
from bin/rspec:3:in `load'
from bin/rspec:3:in `<main>'
from rspec-mode.
Looks like that package is included within the base packages.
And the function is defined within the packages.el
(defun spacemacs-base/init-exec-path-from-shell ()
(use-package exec-path-from-shell
:init (when (or (spacemacs/system-is-mac)
(spacemacs/system-is-linux)
(memq window-system '(x)))
(exec-path-from-shell-initialize))))
from rspec-mode.
Created new issue in Spacemacs syl20bnr/spacemacs#9512
from rspec-mode.
@dgutov So I've checked the ruby version used by other packages, specifically inf-ruby-console-rails
and found that when using the console from within Emacs, correct Ruby binary and versions are used. rspec-mode
seems to be the only package NOT using the rbenv
binaries.
For example, M-x ruby-switch-to-inf
Error message when starting an interactive ruby console session from Emacs. Console still starts anyway.
mapcar: Wrong type argument: stringp, ((path . "/Users/username/Dev/projects/project-name/lib"))
Resulting ruby version within the inf-ruby interactive session.
Running via Spring preloader in process 89593
Loading development environment (Rails 4.2.7.1)
[1] pry(main)> => "robe on 49355"
[2] pry(main)> RUBY_VERSION
=> "2.2.3"
[3] pry(main)>
Results of checking the environment variables from within Emacs
// M-x getenv PATH
=> /Users/username/.rbenv/bin:/Users/username/.rbenv/shims:/Users/mansfield/.exenv/shims: ... rest of path follows
// M-x describe-variable exec-path
=> exec-path is a variable defined in ‘C source code’.
Its value is
("/Users/username/.rbenv/bin" "/Users/username/.rbenv/shims" ... rest of path)
Original value was
("/Users/username/.rbenv/bin" "/Users/username/.rbenv/shims" ... rest of path)
This variable may be risky if used as a file-local variable.
Documentation:
List of directories to search programs to run in subprocesses.
Each element is a string (directory name) or nil (try default directory).
By default the last element of this list is ‘exec-directory’. The
last element is not always used, for example in shell completion
(‘shell-dynamic-complete-command’).
You can customize this variable.
from rspec-mode.
Ouch, zsh.
I just put the rbenv config into ~/.profile
. On Ubuntu, that is.
from rspec-mode.
It's my fault for not paying attention to how Emacs invokes your environment as it boots. The strange part is that non of the other packages exhibit this problem.
🤷♂️
from rspec-mode.
If we're talking about inf-ruby
, then Spring might be calling the shell, and perform initialization doing that... IDK.
from rspec-mode.
Related Issues (20)
- Copy last test command to clipboard HOT 3
- How to customize rspec erorr stack colours matching with my preferred theme. HOT 7
- rspec-mode does not work when I follow the instruction on README HOT 3
- Handle the FactoryGirl -> FactoryBot rename HOT 1
- Multiple rspec processes at the same time HOT 1
- Error for rspec-compile-target-directory HOT 3
- Setting docker variables, does nothing HOT 23
- Running `rspec-verify-matching` uses wrong full path to matched files HOT 7
- Opt out of multiple compilation buffer support HOT 2
- Using rake spec doesn't exclude files HOT 3
- Docker based invocation should not assume presence of bash HOT 4
- Request: Ability to configure primary spec directory
- How disable rspec -b backtrace options HOT 2
- Low level configurable spec runner command HOT 3
- Trouble using rspec-mode with docker HOT 6
- Pry history is broken HOT 1
- Support for request specs in rspec-toggle-spec-and-target? HOT 5
- rspec not using test env if RAILS_ENV is set in the environment. HOT 4
- Newly started spring server gets stopped by SIGHUP at end of run HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-mode.