Sha256: 9196222a6a7f8659bebf60bc8b0c156eba8c022705e01d91956959ec11824ff0
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' require 'sidekiq-status/web' require 'rack/test' describe 'sidekiq status web' do include Rack::Test::Methods let!(:redis) { Sidekiq.redis { |conn| conn } } let!(:job_id) { SecureRandom.hex(12) } def app Sidekiq::Web end before do client_middleware allow(SecureRandom).to receive(:hex).and_return(job_id) end around { |example| start_server(&example) } it 'shows the list of jobs in progress' do capture_status_updates(2) do expect(LongJob.perform_async(1)).to eq(job_id) end get '/statuses' expect(last_response).to be_ok expect(last_response.body).to match(/#{job_id}/) expect(last_response.body).to match(/LongJob/) expect(last_response.body).to match(/working/) end it 'shows a single job in progress' do capture_status_updates(2) do LongJob.perform_async(1, 'another argument') end get "/statuses/#{job_id}" expect(last_response).to be_ok expect(last_response.body).to match(/#{job_id}/) expect(last_response.body).to match(/1,"another argument"/) expect(last_response.body).to match(/working/) end it 'show an error when the requested job ID is not found' do get '/statuses/12345' expect(last_response).to be_not_found expect(last_response.body).to match(/That job can't be found/) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-status-0.7.0 | spec/lib/sidekiq-status/web_spec.rb |