【发布时间】:2023-03-18 15:55:02
【问题描述】:
我有一个测试规范,其中 describes 一个类,其中有各种 contexts,每个都有各种 it 块。
有没有办法可以暂时禁用context?
我尝试在我想禁用的context 的最顶部添加一个pending "temporarily disabled" 调用,当我运行规范时我确实看到了一些关于挂起的信息,但它只是继续运行其余的测试。
这就是我所拥有的:
describe Something
context "some tests" do
it "should blah" do
true
end
end
context "some other tests" do
pending "temporarily disabled"
it "should do something destructive" do
blah
end
end
end
但就像我说的那样,它只是继续在挂起的调用下运行测试。
搜索使我找到了这个mailing list thread,其中 rspec 的创建者 (?) 说这在我正在运行的 rspec 2 中是可能的。我想它确实有效,但它没有达到禁用以下所有测试的预期效果,这是我看到pending 调用时的想法。
有其他选择吗?还是我做错了?
【问题讨论】: