suhlig / delayed-job-test

Testing the delayed_job library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testing delayed_job

Preparation

  1. Start Postgres and create the database:

    brew services start postgresql
    createdb delayed-job-test
  2. Configure the database connection:

    export DB=postgres:///delayed-job-test
  3. Run migrations:

    sequel -m db/migrations $DB
  4. Start the job processing daemon:

    ./scripts/process-jobs run

On a Happy Day

  1. Provide the mail body on STDIN and the email addresses as parameters:

    echo "Dear number $RANDOM, you are an awesome number! Best regards; The Computer." | ./scripts/enqueue-job foo@example.com bar@example.org

    Here, we are sending a letter to foo@example.com and bar@example.org, each as a single job.

  2. Verify that the mailer ran (we simulate it by appending to a 'queue' file):

    tail -f log/mail.queue

    Additional details about the job itself can be found in log/delayed_job.log.

About

Testing the delayed_job library


Languages

Language:Ruby 100.0%