我对 rspec 中的这种模拟和存根不熟悉。实际上在我的控制器中,我有一个动作方法邀请。我想在我的控制器中模拟/存根这个邀请方法......下面是我的代码:
when(/^I invite a subject with required attributes$/) do
patient_enrollment = {subject_enrollment{
country_code: "USA",
subject_id: "Subj 100",
subject_uuid: "23451"}}
return_enrollment = {subject_enrollment{
country_code: "USA",
subject_id: "Subj 100",
activation_code: "xcvbnh",
subject_uuid: "23451"}}
patient_enrollment 是邀请操作(通过 Post 方法)接受的参数,我希望它返回 return_enrollment ...