Sublime Text 3, rbenv, TestUnit, RubyTest and Spri

2019-03-02 23:47发布

问题:

So I've setup RubyTest / Sublime Text 3 and that works fine. I'm having trouble getting spring to work in RubyTest. There is this cryptic setting:

"check_for_spring": false,

But when I set to true and run a test it just gives me the default spring command output e.g:

Version: 1.1.3

Usage: spring COMMAND [ARGS]

Commands for spring itself:

If I follow info on this url (https://github.com/rails/spring), correct way to call a test is?

bin/rake test test/functional/posts_controller_test.rb

Now my current settings for test running are:

"run_ruby_unit_command": "ruby -Itest {relative_path}",
"run_single_ruby_unit_command": "ruby -Itest {relative_path} -n '{test_name}'",

If I try chaning to:

bin/rake test

This doesn't work, gives a command not found error even if I copy / paste the command path and it works in shell.

I'm out of ideas help!

回答1:

This will do the trick

"run_ruby_unit_command": "export PATH=~/.rbenv/shims:$PATH; bin/rake test -Itest {relative_path}",
"run_single_ruby_unit_command": "export PATH=~/.rbenv/shims:$PATH; bin/rake test {relative_path} {test_name}",


回答2:

I use this

"run_ruby_unit_command": "spring rake test {relative_path}",
"run_single_ruby_unit_command": "spring rake test {relative_path} {test_name}"