我将 guard 与 rspec 和 cucumber 一起使用。要连续运行选定的规范,我只需使用 focus
标记来确定我要处理的内容。
但问题是,如果没有带有该标签的规范,我想运行所有规范。
我该怎么做?
注意::我知道所有 RSpec 选项。因此,请仅在阅读问题后回复。
最佳答案
我通过以下配置实现了您描述的行为:
# to run only specific specs, add :focus to the spec
# describe "foo", :focus do
# OR
# it "should foo", :focus do
config.treat_symbols_as_metadata_keys_with_true_values = true # default in rspec 3
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
关于ruby-on-rails - 如果没有可用标签,则运行标记规范或全部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8089495/