Skip to content

Commit

Permalink
tests: switch to minitest
Browse files Browse the repository at this point in the history
Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5,
the shim no longer supports Test::Unit::TestCase.

Adjust the svn2git test suite to support Minitest 5's syntax.

Minitest versions 4 and below do not support the newer Minitest::Test
class that arrived in version 5. For that case, use the
MiniTest::Unit::TestCase class as a fallback.
  • Loading branch information
ktdreyer committed May 15, 2014
1 parent 94b82b7 commit 85106f7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ begin
spec.homepage = "https://github.com/nirvdrum/svn2git"
spec.email = "nirvdrum@gmail.com"
spec.license = 'MIT'
spec.add_development_dependency 'test-unit'
spec.add_development_dependency 'minitest'
spec.add_dependency 'open4'
end
Jeweler::GemcutterTasks.new
Expand Down
6 changes: 3 additions & 3 deletions svn2git.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ Gem::Specification.new do |s|
s.specification_version = 4

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<test-unit>, [">= 0"])
s.add_development_dependency(%q<minitest>, [">= 0"])
s.add_runtime_dependency(%q<open4>, [">= 0"])
else
s.add_dependency(%q<test-unit>, [">= 0"])
s.add_dependency(%q<minitest>, [">= 0"])
s.add_dependency(%q<open4>, [">= 0"])
end
else
s.add_dependency(%q<test-unit>, [">= 0"])
s.add_dependency(%q<minitest>, [">= 0"])
s.add_dependency(%q<open4>, [">= 0"])
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/escape_quotes_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require File.expand_path(File.join(__FILE__, '..', 'test_helper'))

class EscapeQuotesTest < Test::Unit::TestCase
class EscapeQuotesTest < Minitest::Test
def test_identity
expected = 'A string without any need to escape.'
actual = Svn2Git::Migration.escape_quotes(expected)
Expand Down
10 changes: 9 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
$:.unshift "#{File.dirname(__FILE__)}/../lib"

require 'rubygems'
require 'svn2git'
require 'test/unit'
require 'minitest/autorun'

if Minitest.const_defined?('Test')
# We're on Minitest 5+. Nothing to do here.
else
# Minitest 4 doesn't have Minitest::Test yet.
Minitest::Test = MiniTest::Unit::TestCase
end

0 comments on commit 85106f7

Please sign in to comment.