Skip to content

Commit

Permalink
Fix deprecation warnings related to Minitest 6 (davydovanton#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielrumiranda authored Jun 29, 2020
1 parent f08eedb commit 3b8cb5f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions test/test_sidekiq/helpers/date_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class Helper < Sidekiq::WebAction
params = { 'dateFrom' => two_days_ago.to_s,
'dateTo' => today.to_s }

helper_date.calculate_date_range(params).must_equal([diference, today])
_(helper_date.calculate_date_range(params)).must_equal([diference, today])
end

it 'returns default range' do
helper_date.calculate_date_range({}).must_equal([20])
_(helper_date.calculate_date_range({})).must_equal([20])
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/test_sidekiq/statistic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module Statistic

subject = statistic.display

subject.must_be_instance_of Array
_(subject).must_be_instance_of Array
assert_equal subject[0].keys.sort,
%i[name last_job_status number_of_calls queue runtime].sort

Expand All @@ -110,7 +110,7 @@ module Statistic

subject = statistic.display_per_day(worker)

subject.must_be_instance_of Array
_(subject).must_be_instance_of Array
assert_equal subject[0].keys.sort,
%i[date failure last_job_status runtime success total].sort
assert_equal Time.now.strftime("%Y-%m-%d"), subject[0][:date]
Expand All @@ -124,7 +124,7 @@ module Statistic
worker_statistic = base_statistic.statistic_for(worker)[1]
subject = statistic.runtime_for_day(worker, worker_statistic)

subject.must_be_instance_of Hash
_(subject).must_be_instance_of Hash
assert_equal subject.keys.sort, %i[average last max min total].sort
assert_equal worker_statistic[:average_time], subject[:average]
assert_equal worker_statistic[:last_time], subject[:last]
Expand Down
24 changes: 12 additions & 12 deletions test/test_sidekiq/web_api_extension_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def app
get '/api/statistic.json'

response = Sidekiq.load_json(last_response.body)
response['workers'].must_equal []
_(response['workers']).must_equal []
end
end

Expand All @@ -30,8 +30,8 @@ def app
get '/api/statistic.json'

response = Sidekiq.load_json(last_response.body)
response['workers'].wont_equal []
response['workers'].first.keys.must_equal %w[name last_job_status number_of_calls queue runtime]
_(response['workers']).wont_equal []
_( response['workers'].first.keys).must_equal %w[name last_job_status number_of_calls queue runtime]
end
end

Expand All @@ -45,7 +45,7 @@ def app
get '/api/statistic.json?dateFrom=2015-07-28&dateTo=2015-07-29'

response = Sidekiq.load_json(last_response.body)
response['workers'].must_equal []
_(response['workers']).must_equal []
end
end

Expand All @@ -54,8 +54,8 @@ def app
get "/api/statistic.json?dateFrom=2015-07-28&dateTo=#{Date.today}"

response = Sidekiq.load_json(last_response.body)
response['workers'].wont_equal []
response['workers'].count.must_equal 1
_(response['workers']).wont_equal []
_(response['workers'].count).must_equal 1
end
end
end
Expand All @@ -67,7 +67,7 @@ def app
get '/api/statistic/HistoryWorker.json'

response = Sidekiq.load_json(last_response.body)
response['days'].must_equal []
_(response['days']).must_equal []
end
end

Expand All @@ -77,8 +77,8 @@ def app
get '/api/statistic/HistoryWorker.json'

response = Sidekiq.load_json(last_response.body)
response['days'].wont_equal []
response['days'].first.keys.must_equal %w[date failure success total last_job_status runtime]
_(response['days']).wont_equal []
_(response['days'].first.keys).must_equal %w[date failure success total last_job_status runtime]
end
end

Expand All @@ -92,7 +92,7 @@ def app
get '/api/statistic/HistoryWorker.json?dateFrom=2015-07-28&dateTo=2015-07-29'

response = Sidekiq.load_json(last_response.body)
response['days'].must_equal []
_(response['days']).must_equal []
end
end

Expand All @@ -101,8 +101,8 @@ def app
get "/api/statistic/HistoryWorker.json?dateFrom=2015-07-28&dateTo=#{Date.today}"

response = Sidekiq.load_json(last_response.body)
response['days'].wont_equal []
response['days'].count.must_equal 1
_(response['days']).wont_equal []
_(response['days'].count).must_equal 1
end
end
end
Expand Down
30 changes: 15 additions & 15 deletions test/test_sidekiq/web_extension_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def app
end

it 'can display home with statistic tab' do
last_response.status.must_equal 200
last_response.body.must_match(/Sidekiq/)
last_response.body.must_match(/Statistic/)
_(last_response.status).must_equal 200
_(last_response.body).must_match(/Sidekiq/)
_(last_response.body).must_match(/Statistic/)
end
end

Expand All @@ -40,24 +40,24 @@ def app
end

it 'can display statistic page without any failures' do
last_response.status.must_equal 200
last_response.body.must_match(/statistic/)
_(last_response.status).must_equal 200
_(last_response.body).must_match(/statistic/)
end

describe 'when there are statistic' do
it 'should be successful' do
last_response.status.must_equal 200
_(last_response.status).must_equal 200
end
end

it 'can display worker table' do
last_response.body.must_match(/Worker/)
last_response.body.must_match(/Date/)
last_response.body.must_match(/Success/)
last_response.body.must_match(/Failure/)
last_response.body.must_match(/Total/)
last_response.body.must_match(/Time\(sec\)/)
last_response.body.must_match(/Average\(sec\)/)
_(last_response.body).must_match(/Worker/)
_(last_response.body).must_match(/Date/)
_(last_response.body).must_match(/Success/)
_(last_response.body).must_match(/Failure/)
_(last_response.body).must_match(/Total/)
_(last_response.body).must_match(/Time\(sec\)/)
_(last_response.body).must_match(/Average\(sec\)/)
end
end

Expand All @@ -67,7 +67,7 @@ def app
end

it 'can display statistic page without any failures' do
last_response.status.must_equal 200
_(last_response.status).must_equal 200
response = JSON.parse(last_response.body)

assert_includes response, 'date'
Expand All @@ -79,7 +79,7 @@ def app

describe 'when there are statistic' do
it 'should be successful' do
last_response.status.must_equal 200
_(last_response.status).must_equal 200
end
end
end
Expand Down

0 comments on commit 3b8cb5f

Please sign in to comment.