- Clone this repository by running one of the following:
- If using SSH:
git clone [email protected]:gorails-screencasts/active_job_enqueue_all.git
- If using HTTPS:
git clone https://github.com/gorails-screencasts/active_job_enqueue_all.git
- If using SSH:
- Change into the repository directory by running:
cd active_job_enqueue_all
- Run
bundle install
. - Run
bin/rails db:migrate
andbin/rails db:seed
. - Open the provided test in your code editor that is located at
test/integration/unpaid_order_notification_test.rb
. - Run the test with the following command:
bin/rails test test/integration/unpaid_order_notification_test.rb:4
. - Work through the test failures. In order to do so you'll need to implement a number of items including:
- Routes
- HTML markup
- A form that submits to the proper path
- A controller action that does the following:
- Query for all orders with a status of unpaid
- Iterate over the array of unpaid orders, and return into a new array an instantiated UnpaidOrderNotificationJob for each order. Additionally, set a delay for each job that increases for each job.
- Enqueue the array of jobs (
enqueue_all
). - Redirect to the index page of unpaid orders with a notice that the customers are being notified.