Right now Pending includes any jobs that haven't been attempted or locked. This is misleading when you have lots of jobs scheduled for the future. Jobs that are scheduled for the future aren't really "Pending" they are "Scheduled." If they are not included then "Pending" is the actual count of jobs that are waiting to be process right now.
# Running tests:
..../Users/andrewbatshaw/waggl/delayed_job_web/lib/delayed_job_web/application/app.rb:206: warning: instance variable @polling not initialized
/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-4.0.13/lib/active_support/message_encryptor.rb:99: warning: constant OpenSSL::Cipher::Cipher is deprecated
FFF/Users/andrewbatshaw/waggl/delayed_job_web/lib/delayed_job_web/application/app.rb:206: warning: instance variable @polling not initialized
FFF
Finished tests in 0.133645s, 74.8251 tests/s, 97.2726 assertions/s.
1) Failure:
TestMountedInRailsApp#test_overview [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf60a996f8 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"636c269c-3fb6-47fc-910b-cd2e60ac3b04", "X-Runtime"=>"0.008562"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"636c269c-3fb6-47fc-910b-cd2e60ac3b04", "X-Runtime"=>"0.008562"}, @chunked=false, @writer=#<Proc:0x00007faf60a993b0@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
2) Failure:
TestMountedInRailsApp#test_working [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf60a59940 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"8967ca47-6f54-45e1-bf95-3088bdfbccbd", "X-Runtime"=>"0.001309"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"8967ca47-6f54-45e1-bf95-3088bdfbccbd", "X-Runtime"=>"0.001309"}, @chunked=false, @writer=#<Proc:0x00007faf60a59648@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
3) Failure:
TestMountedInRailsApp#test_pending [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf612e2148 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"53a4ceb8-be69-49b0-b13a-ab90bcd18f77", "X-Runtime"=>"0.000986"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"53a4ceb8-be69-49b0-b13a-ab90bcd18f77", "X-Runtime"=>"0.000986"}, @chunked=false, @writer=#<Proc:0x00007faf612e1bf8@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
4) Failure:
TestMountedInRailsApp#test_stats [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf612687a8 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"40af4ed0-aec4-4ecb-8e70-9d6f354b7f4d", "X-Runtime"=>"0.000952"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"40af4ed0-aec4-4ecb-8e70-9d6f354b7f4d", "X-Runtime"=>"0.000952"}, @chunked=false, @writer=#<Proc:0x00007faf61263c80@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
5) Failure:
TestMountedInRailsApp#test_enqueued [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf611e0b50 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"b7d11cac-bfca-4af6-80b1-f82d6b916403", "X-Runtime"=>"0.000990"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"b7d11cac-bfca-4af6-80b1-f82d6b916403", "X-Runtime"=>"0.000990"}, @chunked=false, @writer=#<Proc:0x00007faf611e0290@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
6) Failure:
TestMountedInRailsApp#test_failed [/Users/andrewbatshaw/waggl/delayed_job_web/test/integration/test_mounted_in_rails_app.rb:16]:
Received bad response: #<Rack::MockResponse:0x00007faf6115a5c8 @original_headers={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"fcc9eb1d-bf0d-4248-b7db-cb7f3df00772", "X-Runtime"=>"0.001037"}, @errors="", @body_string=nil, @status=500, @header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"0", "X-Request-Id"=>"fcc9eb1d-bf0d-4248-b7db-cb7f3df00772", "X-Runtime"=>"0.001037"}, @chunked=false, @writer=#<Proc:0x00007faf61159dd0@/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rack-1.5.5/lib/rack/response.rb:27 (lambda)>, @block=nil, @length=0, @body=[]>
10 tests, 13 assertions, 6 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -w -I"lib:lib:test" -I"/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.2/lib" "/Users/andrewbatshaw/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rake-12.3.2/lib/rake/rake_test_loader.rb" "test/integration/test_mounted_in_rails_app.rb" "test/lib/delayed_job_web/application/test_app.rb" "test/test_helper.rb" ]
If folks are interested in this change and can give me some help getting the tests passing, I would be happy to make a PR.
Right now Pending includes any jobs that haven't been attempted or locked. This is misleading when you have lots of jobs scheduled for the future. Jobs that are scheduled for the future aren't really "Pending" they are "Scheduled." If they are not included then "Pending" is the actual count of jobs that are waiting to be process right now.
I have created a fork with those changes - waggl@db43b04. I couldn't get the test suite passing before the making changes. As a result, I have not changed the tests.
If folks are interested in this change and can give me some help getting the tests passing, I would be happy to make a PR.