The 迷你测试标签 https://github.com/wenbo/minitest-tagsgem 不接受标签作为附加参数,而是在标题文本中给出:
it "does stuff(some,tags)"
但如果你想要更多describe
-like 标签,那么我想你想使用小规格元数据 https://github.com/ordinaryzelig/minispec-metadata反而:
it "does stuff", :some, :tags
然后您可以使用以下命令运行选定的测试--tag
option:
$ ruby test_example.rb --tag some --tag tags
请注意,迷你测试标签gem 已经过时了,它会与小规格元数据如果两者同时安装!我建议卸载迷你测试标签,并与小规格元数据反而。
OP 的注释- 所以我最终得到了:
require 'minitest/spec'
require 'minitest/autorun'
require 'minispec-metadata'
require 'rspec/expectations'
describe "One happy and one sad test" do
include RSpec::Matchers
it "is is true", :happy do
expect(true).to be true
end
it "it is false", :sad do
expect(true).to be true
end
end