解决方法
实际上你可以在it语句中使用focus:true:
在您的Spec文件中.
it "needs to focus on this!",focus: => true do #test written here. end
然后在spec / spec_helper中,您需要添加config选项.
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告诉后卫在没有任何过滤的情况下运行所有测试,即使该名称听起来有误导性.