我正在尝试对模拟的 ActiveRecord 模型设定期望。我创建了以下示例,它应该根据我能找到的文档传递。
it "should pass given the correct expectations" do
payment = mock_model(Payment)
payment.should_receive(:membership_id).with(12)
payment.membership_id = 12
end
它失败并出现错误“......模拟'Payment_1004'收到意外消息:membership_id = with (12)”
我意识到我正在测试模拟框架,我只是想了解如何设置期望。