Question

I want to run the rspec tests for Gitlab within vim (calling: !rspec). The problem is, i'm using the vagrant box provided here: https://github.com/gitlabhq/gitlab-vagrant-vm

This means that the whole app is running inside of the vagrant box, and when i call rspec from within vim, it tries to run locally.

Is there any way i can forward the rspec call to the vagrant box, and get the output back locally?

I've found this one: https://github.com/clintoncwolfe/vagrant-rspec-ci But its not what im looking for, since i have to run a custom command.

Maybe its related to: Spork, Vagrant, and Rspec

Was it helpful?

Solution

You can execute any command over ssh, and return the output:

$ ssh user@host echo "hi"
hi

You could use this to run rspec:

$ ssh user@vagrant-ip "cd /path/to/project && rspec"

The thing to bear in mind with this approach is that your shell's environment must be set up correctly to allow access to the rspec command. Your mileage will vary depending on how you manage your rubies.

But you can set up a command in vim to execute this SSH command, and the output will be returned, e.g.:

:command VRspec exec "system('ssh user@vagrant-ip...')"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top