这是我的 rspec 文件。我有PosRequest.authorize_card(@payment_detail)
3 次这条线。有没有一种 DRYer 方法来写这个上下文?
context 'should get' do
it 'error message' do
PosRequest.authorize_card(@payment_detail)
@payment_detail.errorMsg.should_not eql(:nil)
end
it 'bank message' do
PosRequest.authorize_card(@payment_detail)
@payment_detail.cardMsg.should_not eql(:nil)
end
it 'claim message' do
PosRequest.authorize_card(@payment_detail)
@payment_detail.bankMsg.should_not eql(:nil)
end
end