【问题标题】:what is the equivalent to rspec's 'it "should …", focus: true do' in minitest/spec什么相当于 rspec 的“它“应该……”,焦点:在 minitest/spec 中的真实做
【发布时间】:2013-11-07 03:03:19
【问题描述】:

在我对使用 rspec 的项目的测试中,当我只想专注于一个或几个特定的​​测试用例时,我经常在开发时使用“焦点”来节省运行所有测试。

在 Minitest 中(在这种情况下使用规范语法扩展)我找不到等价物。

rspec

it "should work properly", focus: true do
  # stuff
end

Minitest 中的等价物是什么?

【问题讨论】:

    标签: ruby testing rspec minitest


    【解决方案1】:

    安装minitest-focus gem,将require "minitest/focus" 添加到您的测试或助手中,并在您要关注的测试方法之前插入focus

    测试风格:

    focus
    def test_work
      assert work.done?
    end
    

    规范风格:

    focus
    it "should work properly" do
      work.must_be :done?
    end
    

    【讨论】:

    • 唉,它与 minst v5 不兼容,并且通过问题线程似乎也无法在 bundler / rake 下工作。
    • 1.1.0 版添加了 Minitest 5 兼容性。
    • 是的——从昨晚开始!唉,它在我的应用程序中中断了。今天将研究原因。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多