当所有测试用例都是运行时,如何配置guard-rspec忽略一个目录?

How to configure guard-rspec to ignore a directory when all the test cases are running?

假设我的 spec 文件夹中有三位导演;功能,测试,集成。 当我 运行 bundle exec guard 并按回车键时,有没有一种方法可以配置我的 Guardfile 以忽略位于集成目录中的测试用例?

在您的 Guardfile 中,您可以指定 the command to use when running all specs. You can specify an rSpec command with a file exclude pattern 到 运行 除集成规范之外的所有内容:

guard :rspec,
      cmd: 'bundle exec rspec', 
      run_all: { cmd: 'bundle exec rspec --exclude-pattern "**/integrations/*_spec.rb"' } do
  # ...
end

您可能需要根据您的具体需要对此进行一些调整,请参阅答案中的链接以获取相关文档。