本文介绍了Sublime Text 3、rbenv、TestUnit、RubyTest 和 Spring 正确配置以使测试正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经设置了 RubyTest/Sublime Text 3 并且工作正常.我无法让 spring 在 RubyTest 中工作.有一个神秘的设置:

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,

但是当我设置为 true 并运行测试时,它只会给我默认的 spring 命令输出,例如:

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:

如果我关注这个 url 上的信息 (https://github.com/rails/spring), 调用测试的正确方法是?

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}'",

如果我尝试更改为:

bin/rake test

这不起作用,即使我复制/粘贴命令路径并且它在 shell 中工作,也会给出未找到命令的错误.

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

我没有想法了!

推荐答案

这可以解决问题

"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}",

这篇关于Sublime Text 3、rbenv、TestUnit、RubyTest 和 Spring 正确配置以使测试正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 10:48