gpt4 book ai didi

ruby - 守卫,如何临时跟踪特定文件?

转载 作者:数据小太阳 更新时间:2023-10-29 06:56:36 30 4
gpt4 key购买 nike

我正在使用 Guard gem

在开发的某些时候,我只需要跟踪一个特定的文件或几个文件,而不是整个项目。

是否有一些方便的方法来临时跟踪特定文件?

我知道这可以通过修改保护文件来完成,但我认为这不是一个很好的解决方案。

最佳答案

实际上,您可以在 it 语句中使用 focus: true 例如:

在您的规范文件中。

it "needs to focus on this!", focus: true do
#test written here.
end

然后在 spec/spec_helper 中你需要添加配置选项。

RSpec.configure do |config| 
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end

然后 Guard 将自动选择聚焦的测试并仅运行它。此外,config.run_all_when_everything_filtered = true 告诉守卫在没有任何过滤时运行所有测试,即使名称听起来具有误导性。

我发现 Ryan Bate 的 Rails casts 在 Guard 上非常有帮助和 Spork .

关于ruby - 守卫,如何临时跟踪特定文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14478435/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com