Sha256: 56171c35f6d768a7a1cf4fce5db6700eda7d451de89db8cc9aca7e3cee2b679e

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

require 'helper'
require 'sidekiq'
require 'sidekiq/web'
require 'rack/test'

class TestWeb < MiniTest::Unit::TestCase
  describe 'sidekiq web' do
    include Rack::Test::Methods

    def app
      Sidekiq::Web
    end

    before do
      Sidekiq.redis = REDIS
      Sidekiq.redis {|c| c.flushdb }
    end

    class WebWorker
      include Sidekiq::Worker

      def perform(a, b)
        a + b
      end
    end

    it 'shows active queues' do
      get '/'
      assert_equal 200, last_response.status
      assert_match last_response.body, /Sidekiq is down/
      refute_match last_response.body, /default/

      assert WebWorker.perform_async(1, 2)

      get '/'
      assert_equal 200, last_response.status
      assert_match last_response.body, /Sidekiq is down/
      assert_match last_response.body, /default/
      refute_match last_response.body, /foo/

      assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3])

      get '/'
      assert_equal 200, last_response.status
      assert_match last_response.body, /Sidekiq is down/
      assert_match last_response.body, /default/
      assert_match last_response.body, /foo/
    end

    it 'handles queues with no name' do
      get '/queues'
      assert_equal 404, last_response.status
    end

    it 'handles queue view' do
      get '/queues/default'
      assert_equal 200, last_response.status
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sidekiq-1.1.3 test/test_web.rb
sidekiq-1.1.2 test/test_web.rb
sidekiq-1.1.1 test/test_web.rb
sidekiq-1.1.0 test/test_web.rb
sidekiq-1.0.0 test/test_web.rb
sidekiq-0.11.2 test/test_web.rb
sidekiq-0.11.1 test/test_web.rb
sidekiq-0.11.0 test/test_web.rb