我像这样使用rspec:
描述 它应该检查xx': 端
如果满足某些条件,如何防止运行中的某些测试?例如,如果函数is_disabled返回true,则不应运行以下测试:
it 'should check if the xx1':
end
it 'should check if the xx2':
end
但以下应该:
it 'should check if the xx3':
end
it 'should check if the xx4':
end
你能做到:
context "if api calls enabled for MC, @app.is_disabled => 'USD' do
it 'should check if the xx3':
end
it 'should check if the xx4':
end
end
答案 0 :(得分:1)
是的,您可以使用 rspec implicit filters 。例如:
describe "if the app is enabled", :unless => @app.is_disabled do
it 'should check if the xx3':
end
it 'should check if the xx4':
end
end
describe "if the app is disabled", :if => @app.is_disabled do
it 'should check if the xx1':
end
it 'should check if the xx2':
end
end