From bcbe9b258aec081d56ba1ae0188b677014f6abf8 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Mon, 22 Jun 2015 09:14:55 -0700 Subject: [PATCH] Clean up warnings seen with RUBYOPT="-w", fixes #2402 --- bin/sidekiq | 5 +++++ lib/sidekiq/fetch.rb | 2 +- lib/sidekiq/web_helpers.rb | 2 +- test/helper.rb | 1 + test/test_retry.rb | 2 +- test/test_scheduled.rb | 4 ++-- test/test_web.rb | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/sidekiq b/bin/sidekiq index ab33abea..11bdb110 100755 --- a/bin/sidekiq +++ b/bin/sidekiq @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +# Quiet some warnings we see when running in warning mode: +# RUBYOPT=-w bundle exec sidekiq +$TESTING = false +$CELLULOID_DEBUG = false + require_relative '../lib/sidekiq/cli' begin diff --git a/lib/sidekiq/fetch.rb b/lib/sidekiq/fetch.rb index 21e32f2a..a1d228da 100644 --- a/lib/sidekiq/fetch.rb +++ b/lib/sidekiq/fetch.rb @@ -83,7 +83,7 @@ module Sidekiq end def self.done? - @done + defined? @done end def self.strategy diff --git a/lib/sidekiq/web_helpers.rb b/lib/sidekiq/web_helpers.rb index 60e72ebb..6b0adca4 100644 --- a/lib/sidekiq/web_helpers.rb +++ b/lib/sidekiq/web_helpers.rb @@ -45,7 +45,7 @@ module Sidekiq end def display_custom_head - return unless @head_html + return unless defined?(@head_html) @head_html.map { |block| capture(&block) }.join end diff --git a/test/helper.rb b/test/helper.rb index 538b6a14..8ab071fa 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,3 +1,4 @@ +$CELLULOID_DEBUG = false $TESTING = true require 'coveralls' Coveralls.wear! do diff --git a/test/test_retry.rb b/test/test_retry.rb index 40894fad..482af8f6 100644 --- a/test/test_retry.rb +++ b/test/test_retry.rb @@ -354,7 +354,7 @@ class TestRetry < Sidekiq::Test rescue ::StandardError => e1 begin raise ::StandardError, 'Error 2' - rescue ::StandardError => e2 + rescue ::StandardError => _ raise e1 end end diff --git a/test/test_scheduled.rb b/test/test_scheduled.rb index 43a3b3ec..e150c5c3 100644 --- a/test/test_scheduled.rb +++ b/test/test_scheduled.rb @@ -98,8 +98,8 @@ class TestScheduled < Sidekiq::Test i = 500 intervals = i.times.map{ @poller.send(:random_poll_interval) } - assert intervals.all?{|i| i >= 5} - assert intervals.all?{|i| i <= 15} + assert intervals.all?{|x| x >= 5} + assert intervals.all?{|x| x <= 15} assert_in_delta 10, intervals.reduce(&:+).to_f / i, 0.5 end end diff --git a/test/test_web.rb b/test/test_web.rb index 1eb14548..badedbf0 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -292,7 +292,7 @@ class TestWeb < Sidekiq::Test get '/queues/default' assert_equal 200, last_response.status - assert_match /#{msg['args'][2]}/, last_response.body + assert_match(/#{msg['args'][2]}/, last_response.body) end it 'calls updatePage() once when polling' do