Test Rake Tasks

后端 未结 6 945
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-31 18:28

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

What is the best way to test them?

6条回答
  •  北海茫月
    2021-01-31 18:58

    This is pretty well covered in another SO question

    My recommendation, repeated here in summary, is not to try testing rake tasks: extract the code to be tested to a class, model or lib function and test it there. Then just use rake to call the functions and manage dependencies.

提交回复
热议问题