我正在研究一个在Ruby(1.8.7)上运行Rails(2.3.18)的内部Rails应用程序,其中测试用Test :: Unit(2.5.4)和Shoulda(2.10.2)编写
Guard(1.6.2)通过guard-test(0.7.0)在启动时运行所有测试,但它然后进入Pry(0.9.10)提示而不是监听文件更改。我的Gemfile中没有Pry,但它出现在Guard下面的Gemfile.lock中,
我使用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
如何配置Guard以跳过Pry提示并运行我更改过的测试?
答案 0 :(得分: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`.
所以我强烈建议您按照Guard wiki中的说明操作,并使用正确的Readline支持重新编译您的Ruby版本。
作为替代方案,您还可以使用基于简单gets
的交互器附带的旧版Guard 1.4.0,有关该版本支持的功能,请参阅旧README。要获取简单的交互器,请添加
interactor :simple
到Gemfile
。
答案 1 :(得分:0)
我使用no_interations选项执行此操作,以编程方式启动保护
Guard.start :no_interations => true`