例如,在 Jasmine 中,您可以这样做:
describe('Person', function () {
describe('movement methods', function () {
it('#run', function () {
});
it('#jump', function () {
});
});
});
使用 Minitest,您似乎无法拥有“移动方法”类别。你只需要这样做:
class PersonTest
def test_run
end
def test_jump
end
end
有没有办法在Minitest中嵌套?
最佳答案
是的你可以。你可以做这样的事情(不是最漂亮的):
class Person < ActiveSupport::TestCase
class MovementMethods < ActiveSupport::TestCase
test "#run" do
# something
end
test "#jump" do
# something
end
end
end
还可以考虑使用 minitest/spec,您可以编写与 Jasmine 片段更相似的测试用例:
require 'minitest/spec'
describe Person do
describe 'movement methods' do
it '#run' do
# something
end
it '#jump' do
# something
end
end
end
关于ruby-on-rails - 您如何使用 Minitest 进行嵌套测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44831907/