Book Image

Rake Task Management Essentials

By : Andrey Koleshko
Book Image

Rake Task Management Essentials

By: Andrey Koleshko

Overview of this book

Table of Contents (18 chapters)
Rake Task Management Essentials
About the Author
About the Reviewers

The need for tests

The rake tasks are not run as often as regular code from the application. Consider a basic situation when you have a web application with rake tasks that have not been tested. At first glance, after deploying the code to a server and manually testing the application through the web interface, you can be confident that the application works. However, because the rake tasks are usually run by a scheduler, it may be a time bomb. Finally, when the time comes to execute a rake task, it doesn't work because it wasn't tested! Such issues might often occur at the start of your career as a Ruby programmer.

For example, each Rails application has a db:seed rake task. This task is often used to initialize the application using some essential data. For example, it could contain the code to create an administrator in our application. The code is defined in the db/seeds.rb folder that is related to the root of the application. The following is a basic Ruby code to create an administrator...