A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/statianzo/que-testing below:

statianzo/que-testing: Make assertions on enqueued jobs

que-testing

Testing support for the Que queue. que-testing allows you to enqueue jobs without a database and without synchronous running.

Add this line to your application's Gemfile:

gem 'que-testing', :require => false

And then execute:

Or install it yourself as:

$ gem install que-testing

In your test, require 'que/testing' and enqueue jobs as normal. Jobs are stored under a MyJob.jobs array. Because they're static, the stored jobs should be cleared between test runs.

require "que/testing"

describe "Testing" do
  after { MyJob.jobs.clear }

  it "Stores a job" do
    MyJob.enqueue("foo")

    js = MyJob.jobs
    js.length.must_equal 1
    js.first["args"].must_equal ["foo"]
    js.first["job_class"].must_equal "MyJob"
  end
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4