【发布时间】:2021-06-04 00:00:36
【问题描述】:
所以我的应用程序中有一个重试规则。我想使用 rspec 进行测试。
当我在没有传递账户 ID 的情况下调用服务时,它应该给我 false,当传递账户 ID 时,它应该给我 true。
我正在尝试这段代码
options = {
email: 'dev@dev.com'
}
expect_any_instance_of(PaymentService::CreatePayment).to receive(:call)
.with(options)
.and_return(false)
options[:account_id] = 12345
expect_any_instance_of(PaymentService::CreatePayment).to receive(:call)
.with(options)
.and_return(true)
但这对我不起作用。
【问题讨论】:
标签: ruby ruby-on-rails-3 rspec