2013-03-27 59 views
2

我正在使用Test :: Unit(2.5.4)和Shoulda(2.10.2)如何配置Guard以跳过Pry提示并运行我更改的测试?

在Ruby(1.8.7)上运行Rails(2.3.18)的内部Rails应用程序Guard(1.6.2)在启动时通过guard-test(0.7.0)运行所有测试,但它随后会进入Pry(0.9.10)提示符,而不是侦听文件更改。我没有Pry在我的Gemfile中,但它出现在我的Gemfile.lock下的Guard下,

我使用Guard的唯一原因是在文件更改时重新运行测试,它为我的宝石和其他项目...如果我点击[enter],所有的测试都会运行,但这需要比我期望它运行的文件长得多的时间。

后卫显示:

all_after_pass : true 

    all_on_start : true 

    keep_failed : true 

    test_paths  : ["test"] 

Guardfile:

guard :test do 

    watch(%r{^test/.+_test\.rb$}) 

    watch('test/test_helper.rb') { "test" } 

end 

如何配置卫队跳过撬提示,只是运行我改变了测试?

+0

我要补充,我不想禁用互动*,因为我想打[进入]运行在特定点的所有测试的能力在重构中。 *作为推荐这里:http://stackoverflow.com/questions/13170077/why-is-guard-stopping?rq=1 – SciPhi 2013-03-27 23:05:19

+0

我遗漏了文件系统事件gem info:rb-fsevent(0.9.3) – SciPhi 2013-03-27 23:11:10

+0

它doesn不要放在Pry游戏机*上,而要注意变化。它下降到Pry控制台*然后*观察变化。你确定你的watch()配置是正确的吗?目前还不清楚是否'RB-fsevent'你 – 2013-03-27 23:53:19

回答

0

Guard Wiki摘自:

If you are on Mac OS X and have problems with either Guard not reacting to file changes or Pry behaving strangely, then you probably suffer under a Ruby build that uses `libedit` instead of `readline`.

所以我强烈建议遵循在保护维基的说明,并与适当的Readline支持重新编译你的Ruby版本。

作为替代方案,你也可以使用老版本卫队1.4.0自带的简单gets基于交互器,看到老README对于该版本支持的功能。为了让简单的交互器,添加

interactor :simple

Gemfile

+0

加入“RB-的ReadLine”到Gemfile中没有的伎俩(股票运行Mac OS X的红宝石) – SciPhi 2013-03-28 14:17:07

0

我这样做是使用no_interations选项,首发后卫编程

Guard.start :no_interations => true` 
相关问题