测试 Rake 任务 [英] Test Rake Tasks

查看:54
本文介绍了测试 Rake 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个依赖于许多自定义 Rake 任务的 ROR 应用程序.

I am developing a ROR app that relies on many custom Rake tasks.

测试它们的最佳方法是什么?

What is the best way to test them?

推荐答案

Rake 任务很难测试.最简单的解决方案是将逻辑移动到适当模型中的方法中.然后,您可以测试它并从 rake 任务中调用该方法.

Rake tasks are pretty hard to test. The easiest solution would be to move the logic into a method in an appropriate model. You can then test that and just call the method from the rake task.

这篇关于测试 Rake 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆