【问题标题】:Run a spec specified by line number through Guard通过 Guard 运行由行号指定的规范
【发布时间】:2012-03-29 19:42:56
【问题描述】:

使用选项 --line 我可以执行以下操作

spec spec/controller/my_controller_spec.rb -l 34 # test block at line 34 only will be run

如果我使用保护并且不想运行规范文件中的所有测试,我该怎么做?

Guard 文件中是否有一个选项可以接受行号并让 Guard 只运行该测试?

【问题讨论】:

    标签: ruby rspec guard


    【解决方案1】:

    是的,您可以在 Guardfile 中使用 :cli 选项。

    guard 'rspec', :cli => "-l 34"
    

    您可以通过 :cli 使用任何标准 rspec 命令行选项。欲了解更多信息,请查看guard-rspec readme(大约在页面的中间)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-21
      • 2019-11-18
      • 1970-01-01
      • 1970-01-01
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多