Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tests now inherit from Rake::TestCase instead of Test::Unit::TestCase…

… so we no longer need to worry about polluting other tests in ruby
  • Loading branch information...
commit 0534fa59f5b481bf02b199c53bf927784cb49b94 1 parent 16b0c94
@drbrain drbrain authored
Showing with 47 additions and 75 deletions.
  1. +5 −8 test/helper.rb
  2. +1 −1  test/test_rake.rb
  3. +4 −6 test/test_rake_application.rb
  4. +1 −1  test/test_rake_clean.rb
  5. +1 −2  test/test_rake_definitions.rb
  6. +1 −1  test/test_rake_dsl.rb
  7. +1 −1  test/test_rake_early_time.rb
  8. +1 −1  test/test_rake_extension.rb
  9. +1 −1  test/test_rake_file_creation_task.rb
  10. +1 −2  test/test_rake_file_list.rb
  11. +2 −3 test/test_rake_file_task.rb
  12. +1 −3 test/test_rake_file_utils.rb
  13. +1 −1  test/test_rake_ftp_file.rb
  14. +1 −2  test/test_rake_functional.rb
  15. +3 −6 test/test_rake_invocation_chain.rb
  16. +1 −1  test/test_rake_makefile_loader.rb
  17. +1 −1  test/test_rake_multi_task.rb
  18. +1 −2  test/test_rake_name_space.rb
  19. +1 −2  test/test_rake_package_task.rb
  20. +4 −5 test/test_rake_path_map.rb
  21. +1 −1  test/test_rake_pseudo_status.rb
  22. +1 −2  test/test_rake_rdoc_task.rb
  23. +1 −2  test/test_rake_require.rb
  24. +1 −2  test/test_rake_rules.rb
  25. +2 −6 test/test_rake_task.rb
  26. +1 −1  test/test_rake_task_arguments.rb
  27. +1 −1  test/test_rake_task_lib.rb
  28. +2 −3 test/test_rake_task_manager.rb
  29. +1 −2  test/test_rake_test_task.rb
  30. +1 −2  test/test_rake_top_level_functions.rb
  31. +1 −2  test/test_rake_win32.rb
  32. +1 −1  test/test_sys.rb
View
13 test/helper.rb
@@ -7,14 +7,7 @@
require 'rake'
-module TestMethods
- # Shim method for compatibility
- def assert_exception(ex, msg="", &block)
- assert_raise(ex, msg, &block)
- end
-end
-
-class Test::Unit::TestCase
+class Rake::TestCase < Test::Unit::TestCase
include Rake::DSL
def ignore_deprecations
@@ -23,4 +16,8 @@ def ignore_deprecations
ensure
Rake.application.options.ignore_deprecate = false
end
+
+ def assert_exception(ex, msg="", &block)
+ assert_raise(ex, msg, &block)
+ end
end
View
2  test/test_rake.rb
@@ -1,6 +1,6 @@
require 'test/helper'
-class TestRake < Test::Unit::TestCase
+class TestRake < Rake::TestCase
def test_each_dir_parent
assert_equal ['a'], alldirs('a')
assert_equal ['a/b', 'a'], alldirs('a/b')
View
10 test/test_rake_application.rb
@@ -5,10 +5,9 @@
TESTING_REQUIRE = [ ]
######################################################################
-class TestRakeApplication < Test::Unit::TestCase
+class TestRakeApplication < Rake::TestCase
include CaptureStdout
include InEnvironment
- include TestMethods
def setup
super
@@ -369,9 +368,8 @@ def test_deprecation_message
######################################################################
-class TestRakeApplicationOptions < Test::Unit::TestCase
+class TestRakeApplicationOptions < Rake::TestCase
include CaptureStdout
- include TestMethods
include InEnvironment
def setup
@@ -734,7 +732,7 @@ def @app.exit(*args)
end
end
-class TestRakeTaskArgumentParsing < Test::Unit::TestCase
+class TestRakeTaskArgumentParsing < Rake::TestCase
def setup
@app = Rake::Application.new
end
@@ -777,7 +775,7 @@ def test_keeps_embedded_spaces
end
-class TestRakeTaskArgumentParsing < Test::Unit::TestCase
+class TestRakeTaskArgumentParsing < Rake::TestCase
include InEnvironment
def test_terminal_width_using_env
View
2  test/test_rake_clean.rb
@@ -1,7 +1,7 @@
require 'test/helper'
require 'rake/clean'
-class TestRakeClean < Test::Unit::TestCase
+class TestRakeClean < Rake::TestCase
include Rake
def test_clean
assert Task['clean'], "Should define clean"
View
3  test/test_rake_definitions.rb
@@ -3,9 +3,8 @@
require 'test/file_creation'
######################################################################
-class TestRakeDefinitions < Test::Unit::TestCase
+class TestRakeDefinitions < Rake::TestCase
include Rake
- include TestMethods
EXISTINGFILE = "testdata/existing"
View
2  test/test_rake_dsl.rb
@@ -1,6 +1,6 @@
require 'test/helper'
-class TestRakeDsl < Test::Unit::TestCase
+class TestRakeDsl < Rake::TestCase
def test_namespace_command
namespace "n" do
View
2  test/test_rake_early_time.rb
@@ -1,6 +1,6 @@
require 'test/helper'
-class TestRakeEarlyTime < Test::Unit::TestCase
+class TestRakeEarlyTime < Rake::TestCase
def test_create
early = Rake::EarlyTime.instance
assert early <= Time.now
View
2  test/test_rake_extension.rb
@@ -2,7 +2,7 @@
require 'stringio'
######################################################################
-class TestRakeExtension < Test::Unit::TestCase
+class TestRakeExtension < Rake::TestCase
module Redirect
def error_redirect
View
2  test/test_rake_file_creation_task.rb
@@ -3,7 +3,7 @@
require 'test/file_creation'
######################################################################
-class TestRakeFileCreationTask < Test::Unit::TestCase
+class TestRakeFileCreationTask < Rake::TestCase
include Rake
include Rake::DSL
include FileCreation
View
3  test/test_rake_file_list.rb
@@ -1,10 +1,9 @@
require 'test/helper'
require 'test/capture_stdout'
-class TestRakeFileList < Test::Unit::TestCase
+class TestRakeFileList < Rake::TestCase
FileList = Rake::FileList
include CaptureStdout
- include TestMethods
def setup
create_test_data
View
5 test/test_rake_file_task.rb
@@ -3,10 +3,9 @@
require 'test/file_creation'
######################################################################
-class TestRakeFileTask < Test::Unit::TestCase
+class TestRakeFileTask < Rake::TestCase
include Rake
include FileCreation
- include TestMethods
def setup
Task.clear
@@ -89,7 +88,7 @@ def ztest_file_deletes_on_failure
end
######################################################################
-class TestRakeDirectoryTask < Test::Unit::TestCase
+class TestRakeDirectoryTask < Rake::TestCase
include Rake
def setup
View
4 test/test_rake_file_utils.rb
@@ -3,10 +3,8 @@
require 'fileutils'
require 'stringio'
-class TestRakeFileUtils < Test::Unit::TestCase
+class TestRakeFileUtils < Rake::TestCase
include FileCreation
- include TestMethods
- include Rake::DSL
def setup
File.chmod(0750, "test/shellcommand.rb")
View
2  test/test_rake_ftp_file.rb
@@ -13,7 +13,7 @@ def self.now
end
-class TestRakeFtpFile < Test::Unit::TestCase
+class TestRakeFtpFile < Rake::TestCase
def setup
Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
View
3  test/test_rake_functional.rb
@@ -35,9 +35,8 @@ def initialize(*args)
end
end if defined? Session
-class TestRakeFunctional < Test::Unit::TestCase
+class TestRakeFunctional < Rake::TestCase
include InEnvironment
- include TestMethods
RUBY_COMMAND = 'ruby'
View
9 test/test_rake_invocation_chain.rb
@@ -1,8 +1,7 @@
require 'test/helper'
######################################################################
-class TestRakeAnEmptyInvocationChain < Test::Unit::TestCase
- include TestMethods
+class TestRakeAnEmptyInvocationChain < Rake::TestCase
def setup
@empty = Rake::InvocationChain::EMPTY
@@ -20,8 +19,7 @@ def test_to_s
end
######################################################################
-class TestRakeAnInvocationChainWithOneMember < Test::Unit::TestCase
- include TestMethods
+class TestRakeAnInvocationChainWithOneMember < Rake::TestCase
def setup
@empty = Rake::InvocationChain::EMPTY
@@ -48,8 +46,7 @@ def test_to_s
end
######################################################################
-class TestRakeAnInvocationChainWithMultipleMember < Test::Unit::TestCase
- include TestMethods
+class TestRakeAnInvocationChainWithMultipleMember < Rake::TestCase
def setup
@first_member = "A"
View
2  test/test_rake_makefile_loader.rb
@@ -1,7 +1,7 @@
require 'test/helper'
require 'rake/loaders/makefile'
-class TestRakeMakefileLoader < Test::Unit::TestCase
+class TestRakeMakefileLoader < Rake::TestCase
include Rake
def test_parse
View
2  test/test_rake_multi_task.rb
@@ -2,7 +2,7 @@
require 'thread'
######################################################################
-class TestRakeMultiTask < Test::Unit::TestCase
+class TestRakeMultiTask < Rake::TestCase
include Rake
include Rake::DSL
View
3  test/test_rake_name_space.rb
@@ -1,7 +1,6 @@
require 'test/helper'
-class TestRakeNameSpace < Test::Unit::TestCase
- include TestMethods
+class TestRakeNameSpace < Rake::TestCase
class TM
include Rake::TaskManager
View
3  test/test_rake_package_task.rb
@@ -1,8 +1,7 @@
require 'test/helper'
require 'rake/packagetask'
-class TestRakePackageTask < Test::Unit::TestCase
- include TestMethods
+class TestRakePackageTask < Rake::TestCase
def test_initialize
pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
View
9 test/test_rake_path_map.rb
@@ -1,8 +1,7 @@
require 'test/helper'
# ====================================================================
-class TestRakePathMap < Test::Unit::TestCase
- include TestMethods
+class TestRakePathMap < Rake::TestCase
def test_returns_self_with_no_args
assert_equal "abc.rb", "abc.rb".pathmap
@@ -157,7 +156,7 @@ def test_complex_patterns
end
end
-class TestRakePathMapExplode < Test::Unit::TestCase
+class TestRakePathMapExplode < Rake::TestCase
def setup
String.class_eval { public :pathmap_explode }
end
@@ -184,7 +183,7 @@ def test_explode
end
end
-class TestRakePathMapPartial < Test::Unit::TestCase
+class TestRakePathMapPartial < Rake::TestCase
def test_pathmap_partial
@path = "1/2/file"
def @path.call(n)
@@ -200,7 +199,7 @@ def @path.call(n)
end
end
-class TestRakeFileListPathMap < Test::Unit::TestCase
+class TestRakeFileListPathMap < Rake::TestCase
def test_file_list_supports_pathmap
assert_equal ['a', 'b'], FileList['dir/a.rb', 'dir/b.rb'].pathmap("%n")
end
View
2  test/test_rake_pseudo_status.rb
@@ -1,7 +1,7 @@
require 'test/helper'
require 'test/capture_stdout'
-class TestRakePseudoStatus < Test::Unit::TestCase
+class TestRakePseudoStatus < Rake::TestCase
def test_with_zero_exit_status
s = Rake::PseudoStatus.new
assert_equal 0, s.exitstatus
View
3  test/test_rake_rdoc_task.rb
@@ -8,9 +8,8 @@
$VERBOSE = old_verbose
end
-class TestRakeRDocTask < Test::Unit::TestCase
+class TestRakeRDocTask < Rake::TestCase
include Rake
- include TestMethods
def setup
Task.clear
View
3  test/test_rake_require.rb
@@ -1,8 +1,7 @@
require 'test/helper'
# ====================================================================
-class TestRakeRequire < Test::Unit::TestCase
- include TestMethods
+class TestRakeRequire < Rake::TestCase
def test_can_load_rake_library
app = Rake::Application.new
View
3  test/test_rake_rules.rb
@@ -3,10 +3,9 @@
require 'test/file_creation'
######################################################################
-class TestRakeRules < Test::Unit::TestCase
+class TestRakeRules < Rake::TestCase
include Rake
include FileCreation
- include TestMethods
SRCFILE = "testdata/abc.c"
SRCFILE2 = "testdata/xyz.c"
View
8 test/test_rake_task.rb
@@ -2,11 +2,9 @@
require 'fileutils'
######################################################################
-class TestRakeTask < Test::Unit::TestCase
+class TestRakeTask < Rake::TestCase
include CaptureStdout
include Rake
- include TestMethods
- include Rake::DSL
def setup
Task.clear
@@ -271,11 +269,9 @@ def test_settable_comments
end
######################################################################
-class TestRakeTaskWithArguments < Test::Unit::TestCase
+class TestRakeTaskWithArguments < Rake::TestCase
include CaptureStdout
include Rake
- include TestMethods
- include Rake::DSL
def setup
super
View
2  test/test_rake_task_arguments.rb
@@ -1,7 +1,7 @@
require 'test/helper'
######################################################################
-class TestRakeTaskArguments < Test::Unit::TestCase
+class TestRakeTaskArguments < Rake::TestCase
def teardown
ENV.delete('rev')
ENV.delete('VER')
View
2  test/test_rake_task_lib.rb
@@ -1,7 +1,7 @@
require 'test/helper'
require 'rake/tasklib'
-class TestRakeTaskLib < Test::Unit::TestCase
+class TestRakeTaskLib < Rake::TestCase
def test_paste
tl = Rake::TaskLib.new
assert_equal :ab, tl.paste(:a, :b)
View
5 test/test_rake_task_manager.rb
@@ -4,8 +4,7 @@ class TaskManager
include Rake::TaskManager
end
-class TestRakeTaskManager < Test::Unit::TestCase
- include TestMethods
+class TestRakeTaskManager < Rake::TestCase
def setup
@tm = TaskManager.new
@@ -146,7 +145,7 @@ def test_correctly_scoped_prerequisites_are_invoked
end
-class TestRakeTaskManagerArgumentResolution < Test::Unit::TestCase
+class TestRakeTaskManagerArgumentResolution < Rake::TestCase
def setup
super
Rake.application.options.ignore_deprecate = true
View
3  test/test_rake_test_task.rb
@@ -1,9 +1,8 @@
require 'test/helper'
require 'rake/testtask'
-class TestRakeTestTask < Test::Unit::TestCase
+class TestRakeTestTask < Rake::TestCase
include Rake
- include TestMethods
def setup
Task.clear
View
3  test/test_rake_top_level_functions.rb
@@ -1,9 +1,8 @@
require 'test/helper'
require 'test/capture_stdout'
-class TestRakeTopLevelFunctions < Test::Unit::TestCase
+class TestRakeTopLevelFunctions < Rake::TestCase
include CaptureStdout
- include TestMethods
def setup
super
View
3  test/test_rake_win32.rb
@@ -1,9 +1,8 @@
require 'test/helper'
require 'test/in_environment'
-class TestRakeWin32 < Test::Unit::TestCase
+class TestRakeWin32 < Rake::TestCase
include InEnvironment
- include TestMethods
include CaptureStdout
Win32 = Rake::Win32
View
2  test/test_sys.rb
@@ -8,7 +8,7 @@
$VERBOSE = old_verbose
end
-class TestSys < Test::Unit::TestCase
+class TestSys < Rake::TestCase
include FileCreation
def test_split_all
Please sign in to comment.
Something went wrong with that request. Please try again.