有人知道一种方法来跳过一个组中的多个示例,而不必在它们之间重复跳过语句吗?
例如,给出此测试:
describe 'some feature' do
it 'should do something' do
...
end
it 'should do something else too' do
...
end
end
skip
如果放在第一个示例之前不起作用,就像这样:
describe 'some feature' do
skip 'I would like to skip both with one statement'
it 'should do something' do
...
end
it 'should do something else too' do
...
end
end
[理想的解决方案将允许我跳过示例结构的任何级别(describe
/ feature
,context
和scenario
/ it
),并跳过该层次结构级别的所有子级。
换句话说,请允许我做:
describe 'some feature' do
it 'should do something' do
...
end
it 'should do something else too' do
skip 'just one of these for now'
...
end
end
AND
describe 'some feature' do
skip 'everything within this describe block'
it 'should do something' do
...
end
it 'should do something else too' do
...
end
end
AS WELL AS
describe 'some feature' do
context 'such and such' do
skip 'just this context'
it 'should do something' do
...
end
it 'should do something else too' do
...
end
it 'but do not skip this one' do
...
end
end
如documentation中所述,您可以使用元数据跳过上下文。
describe 'some feature', :skip do
it 'should do something' do
# This example is skipped
end
it 'should do something else too' do
# This example is skipped as well
end
end