Tmux Part 4: Vim Integration

When I try to run the specs in the current file, vim-rspec seems to be getting the path wrong. It assumes the path to be

/path/to/project/root/current_spec.rb

and not

/path/to/project/root/spec/subdir/current_spec.rb

This is even if I cd to the spec file’s subdirectory and launch vim with the spec as a command line argument. At first I thought it was because I was finding the file with Ctrl-P, but that’s not it.

EDIT: Actually, I’m wrong. If I launch vim in the subdirectory containing the spec file, when Vim-Rspec passes off that filename, RSpec has no problem loading it. BUT in this case, Rspec can’t load ‘rails_helper’ which is in the require line of that spec file. So if I’m in project root, vim-rspec isn’t telling Rspec where the spec file is located – it’s just letting RSpec assume that it’s the same directory from which vim was launched. And if launched from the subdirectory, Rspec doesn’t know where to look for the helper files. Either way, the lack of awareness of where the file is located is fatal.

Note that running “All Specs” works just fine. It’s just the commands that require a specific filename that are getting broken.