Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Backport test suite to Minitest 4 so we can test against Rails 4.

  • Loading branch information...
commit babfdc96c52ebeb98c0b30ca0574c024cd11416d 1 parent 6923f88
@mperham authored
View
6 sidekiq.gemspec
@@ -20,9 +20,9 @@ Gem::Specification.new do |gem|
gem.add_dependency 'celluloid', '>= 0.15.1'
gem.add_dependency 'json'
gem.add_development_dependency 'sinatra'
- gem.add_development_dependency 'minitest', '~> 5'
+ gem.add_development_dependency 'minitest', '~> 4.2'
gem.add_development_dependency 'rake'
- gem.add_development_dependency 'actionmailer', '>= 3.2.0'
- gem.add_development_dependency 'activerecord', '>= 3.2.0'
+ gem.add_development_dependency 'actionmailer', '>= 4.0.0'
+ gem.add_development_dependency 'activerecord', '>= 4.0.0'
gem.add_development_dependency 'coveralls'
end
View
2  test/helper.rb
@@ -25,6 +25,8 @@
require 'sidekiq/util'
Sidekiq.logger.level = Logger::ERROR
+Sidekiq::Test = MiniTest::Unit::TestCase
+
require 'sidekiq/redis_connection'
redis_url = ENV['REDIS_URL'] || 'redis://localhost/15'
REDIS = Sidekiq::RedisConnection.create(:url => redis_url, :namespace => 'testy')
View
2  test/test_api.rb
@@ -1,6 +1,6 @@
require 'helper'
-class TestApi < Minitest::Test
+class TestApi < Sidekiq::Test
describe "stats" do
before do
Sidekiq.redis {|c| c.flushdb }
View
2  test/test_cli.rb
@@ -11,7 +11,7 @@ def cli.valid?
!@code
end
-class TestCli < Minitest::Test
+class TestCli < Sidekiq::Test
describe 'with cli' do
before do
View
2  test/test_client.rb
@@ -2,7 +2,7 @@
require 'sidekiq/client'
require 'sidekiq/worker'
-class TestClient < Minitest::Test
+class TestClient < Sidekiq::Test
describe 'with mock redis' do
before do
@redis = Minitest::Mock.new
View
2  test/test_exception_handler.rb
@@ -17,7 +17,7 @@ def invoke_exception(args)
end
end
-class TestExceptionHandler < Minitest::Test
+class TestExceptionHandler < Sidekiq::Test
describe "with mock logger" do
before do
@old_logger = Sidekiq.logger
View
2  test/test_extensions.rb
@@ -8,7 +8,7 @@
Sidekiq.hook_rails!
-class TestExtensions < Minitest::Test
+class TestExtensions < Sidekiq::Test
describe 'sidekiq extensions' do
before do
Sidekiq.redis = REDIS
View
2  test/test_fetch.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/fetch'
-class TestFetcher < Minitest::Test
+class TestFetcher < Sidekiq::Test
describe 'fetcher' do
before do
Sidekiq.redis = { :namespace => 'fuzzy' }
View
2  test/test_manager.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/manager'
-class TestManager < Minitest::Test
+class TestManager < Sidekiq::Test
describe 'manager' do
it 'creates N processor instances' do
View
2  test/test_middleware.rb
@@ -2,7 +2,7 @@
require 'sidekiq/middleware/chain'
require 'sidekiq/processor'
-class TestMiddleware < Minitest::Test
+class TestMiddleware < Sidekiq::Test
describe 'middleware chain' do
before do
$errors = []
View
2  test/test_processor.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/processor'
-class TestProcessor < Minitest::Test
+class TestProcessor < Sidekiq::Test
TestException = Class.new(StandardError)
TEST_EXCEPTION = TestException.new("kerboom!")
View
6 test/test_redis_connection.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/redis_connection'
-class TestRedisConnection < Minitest::Test
+class TestRedisConnection < Sidekiq::Test
describe ".create" do
@@ -14,7 +14,7 @@ class TestRedisConnection < Minitest::Test
it "sets a custom network_timeout if specified" do
pool = Sidekiq::RedisConnection.create(:network_timeout => 8)
redis = pool.checkout
-
+
assert_equal 8, redis.client.timeout
end
@@ -42,7 +42,7 @@ class TestRedisConnection < Minitest::Test
describe "pool_timeout" do
it "uses a given :timeout over the default of 1" do
pool = Sidekiq::RedisConnection.create(:pool_timeout => 5)
-
+
assert_equal 5, pool.instance_eval{ @timeout }
end
View
2  test/test_retry.rb
@@ -2,7 +2,7 @@
require 'sidekiq/scheduled'
require 'sidekiq/middleware/server/retry_jobs'
-class TestRetry < Minitest::Test
+class TestRetry < Sidekiq::Test
describe 'middleware' do
before do
@redis = Minitest::Mock.new
View
2  test/test_scheduled.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/scheduled'
-class TestScheduled < Minitest::Test
+class TestScheduled < Sidekiq::Test
class ScheduledWorker
include Sidekiq::Worker
def perform(x)
View
2  test/test_scheduling.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/scheduled'
-class TestScheduling < Minitest::Test
+class TestScheduling < Sidekiq::Test
describe 'middleware' do
before do
@redis = Minitest::Mock.new
View
4 test/test_sidekiq.rb
@@ -1,7 +1,7 @@
# encoding: utf-8
require 'helper'
-class TestSidekiq < Minitest::Test
+class TestSidekiq < Sidekiq::Test
describe 'json processing' do
it 'loads json' do
assert_equal ({"foo" => "bar"}), Sidekiq.load_json("{\"foo\":\"bar\"}")
@@ -34,4 +34,4 @@ class TestSidekiq < Minitest::Test
assert_equal "Calm down, bro\n", $stdout.string
end
end
-end
+end
View
2  test/test_testing.rb
@@ -9,7 +9,7 @@
Sidekiq.hook_rails!
-class TestTesting < Minitest::Test
+class TestTesting < Sidekiq::Test
describe 'sidekiq testing' do
class PerformError < RuntimeError; end
View
2  test/test_testing_inline.rb
@@ -9,7 +9,7 @@
Sidekiq.hook_rails!
-class TestInline < Minitest::Test
+class TestInline < Sidekiq::Test
describe 'sidekiq inline testing' do
class InlineError < RuntimeError; end
class ParameterIsNotString < RuntimeError; end
View
2  test/test_util.rb
@@ -1,7 +1,7 @@
require 'helper'
require 'sidekiq/util'
-class TestUtil < Minitest::Test
+class TestUtil < Sidekiq::Test
describe 'util' do
it 'generates the same process id when included in two or more classes' do
class One
View
2  test/test_web.rb
@@ -3,7 +3,7 @@
require 'sidekiq/web'
require 'rack/test'
-class TestWeb < Minitest::Test
+class TestWeb < Sidekiq::Test
describe 'sidekiq web' do
include Rack::Test::Methods
Please sign in to comment.
Something went wrong with that request. Please try again.