我正在开发一个内部Rails应用程序,它在Ruby(1.8.7)上运行Rails(2.3.18),测试用Test::Unit(2.5.4)和Shoulda(2.10.2)编写
Guard(1.6.2)在启动时通过Guard test(0.7.0)运行所有测试,但随后它会进入一个Pry(0.9.10)提示符,而不是监听文件更改我没有撬开我的Gemfile,但它出现在我的Gemfile.lock中,
我使用Guard的唯一原因是在文件更改时重新运行测试,这对我的gems和其他项目都是如此……如果我点击[enter],所有的测试都会运行,但这比我期望它运行的文件要长得多。
卫兵表演:

  all_after_pass : true

  all_on_start   : true

  keep_failed    : true

  test_paths     : ["test"]

警卫:
guard :test do

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

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

end

如何配置Guard跳过Pry提示并运行已更改的测试?

最佳答案

摘自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

关于ruby-on-rails - 如何配置Guard跳过Pry提示并仅运行更改的测试?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15671191/

10-10 01:35
查看更多