如何针对rspec中的不同条件重复特定测试?
现在我做
it 'should be able to go through the checkout flow with shipping_address/shipping_fees' do
@app.account_ids.each_with_index do |account_id, country|
TEST BODY
end
end
但这似乎不是一种优雅的方式。还有更好的方法吗?
对于每个account_id来说,相当于一遍又一遍地重复TEST BODY?
答案 0 :(得分:0)
您可以按如下方式重复it
来电:
@app.account_ids.each_with_index do |account_id, country|
it "should be able to go through the checkout flow with shipping_address/shipping_fees" do
TEST BODY
end
end
这将允许TEST BODY
的每个实例独立失败。