Sha256: f3bd6c74390ad948718ade6dabd5f473771c33c9feba4b9d297ce3fa29f7b03d

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'
require 'timecop'


describe ResqueHistory::Server do
  include Rack::Test::Methods

  def app
    @app ||= Resque::Server.new
  end

  let :queues do
    Resque.redis.sadd(:queues, "queue1")
    Resque.redis.sadd(:queues, "queue2")
    Resque.redis.sadd(:queues, "queue3")
  end

  before do
    queues
    Resque.enqueue(HistoryJob, 12)
    job = Resque.reserve('test')
    Timecop.freeze(2008, 10, 5, 10, 12) do
      job.perform
    end
  end

  it "should respond to /history" do
    get '/history'
    last_response.should be_ok
    last_response.body.should include("HistoryJob")
    last_response.body.should include("0 secs")
    last_response.body.should include("2008-10-05 10:12")
  end

  it "should respond to remove history" do
    get '/history'
    last_response.body.should include("HistoryJob")
    post "/history/clear"
    last_response.should be_redirect
    get '/history'
    last_response.body.should_not include("HistoryJob")
  end

  it "should not show full message if there is small number of jobs in the history" do
    get '/history'
    last_response.body.should =~ /Showing 0 to.*jobs/m
  end

end

class HistoryJob
  extend Resque::Plugins::History
  @queue = :test

  def self.perform(*args)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-history-1.12.3 spec/resque-web_spec.rb
resque-history-1.12.2 spec/resque-web_spec.rb
resque-history-1.12.1 spec/resque-web_spec.rb
resque-history-1.12.0 spec/resque-web_spec.rb
resque-history-1.11.1 spec/resque-web_spec.rb
resque-history-1.11.0 spec/resque-web_spec.rb
resque-history-1.10.0 spec/resque-web_spec.rb