我在某个控制器的create
内有这段代码
if @company.save && ServiceCompany.create(service_id: params[:service_id], company_id: @company.id)
update_vendor_on_customer_io
sign_in(:company, @company)
redirect_to edit_vendor_company_url(@company.secret)
else
render action: "new", layout: "assistant"
end
如果update_vendor_on_customer_io
被调用,我想用rspec进行测试。我试过这样的事情:
expect(subject.create).to receive(:new_or_update_vendor).with(param)
但没有奏效。有可能做测试吗?