minitest/spec 中 rspec 的“它应该……",focus: true do 的等价物是什么? [英] what is the equivalent to rspec's 'it "should …", focus: true do' in minitest/spec

查看:24
本文介绍了minitest/spec 中 rspec 的“它应该……",focus: true do 的等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

rspec

它应该可以正常工作",focus: true do# 东西结尾

Minitest 中的等价物是什么?

解决方案

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

测试风格:

焦点def test_work断言工作完成了吗?结尾

规格样式:

焦点它应该正常工作"做work.must_be :完成了吗?结尾

In my tests in projects that use rspec I often use a 'focus' while developing to save running all the tests when I want to focus on just one or a few specific test cases.

In Minitest (using the spec syntax extensions in this case) I can't find an equivalent.

In rspec

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

what's the equivalent in Minitest?

解决方案

Install the minitest-focus gem, add require "minitest/focus" to your test or helper, and insert focus before the test method you want to focus on.

Test-style:

focus
def test_work
  assert work.done?
end

Spec-style:

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

这篇关于minitest/spec 中 rspec 的“它应该……",focus: true do 的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆