mercadolibre/fury-little_monster-gem

Name: fury-little_monster-gem

Owner: MercadoLibre

Description: null

Created: 2016-06-13 17:14:55.0

Updated: 2018-05-17 13:53:45.0

Pushed: 2017-11-28 19:09:16.0

Homepage: null

Size: 384

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status Test Coverage Code Climate

fury-little_monster

RSPEC Matchers
Installation

in your spec_helper add the following line

ire 'little_monster/rspec'
helpers
generate_job

it takes a job and a hash of parameters and returns a fully configured job instance

generate_job with data
rate_job :my_job, data: { a: :b }
generate_job with task mocked to fail
rate_job :my_job, data: { a: :b }, fails: { task: :my_task, error: MyError.new }
generate_job with multiples tasks mocked to fail
rate_job :my_job, data: { a: :b }, fails: [{ task: :my_task, error: MyError.new }, { task: :my_other_task, error: MyError.new }]
run_job

given a generated job, it returns a JobResult object to make expectation about the run

generate_task

it takes a task class or symbol and returns a fully configured task instance

generate_task with data
rate_task MyJob::MyTask, data: { a: :b }
matchers
have_run

given a JobResult object expects the job to run that list of tasks

ct(run_job(:my_job)).to have_run(:my_task, :my_other_task)
have_run_task

given a JobResult object expects the job to run the a given task with a certain data

ct(run_job(:my_job)).to have_run_task(:my_task).with_data(a: :b)
have_ended_with_status

given a JobResult object expects the job have a given status after the run

ct(run_job(:my_job)).to have_ended_with_status(:success)
have_data

given checks a job or JobResult instance data

ct(run_job(:my_job)).to have_ended_with_status(:success)
ct(generate_job(:my_job)).to have_ended_with_status(:success)
have_retries

given job instance, a class or a class symbol it expects the retries for that class

ct(:my_job).to have_retries(3)
have_callback_retries

given job instance, a class or a class symbol it expects the callback retries for that class

ct(my_job).to have_callback_retries(10)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.