Created
November 3, 2008 15:36
-
-
Save lifo/21892 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/test_context.rb b/test/test_context.rb | |
index 625160d..442dfe4 100644 | |
--- a/test/test_context.rb | |
+++ b/test/test_context.rb | |
@@ -54,4 +54,8 @@ class TestContext < Test::Unit::TestCase | |
end | |
end | |
end | |
+ | |
+ def test_all_tests_get_run | |
+ assert_equal 7, self.class.total_tests_ran_in_file | |
+ end | |
end | |
diff --git a/test/test_core_ext.rb b/test/test_core_ext.rb | |
index 2d5ec30..460c0ce 100644 | |
--- a/test/test_core_ext.rb | |
+++ b/test/test_core_ext.rb | |
@@ -14,4 +14,8 @@ class TestCoreExt < Test::Unit::TestCase | |
assert :this_has_been_great, "This has been great".to_method_name | |
end | |
end | |
+ | |
+ def test_all_tests_get_run | |
+ assert_equal 4, self.class.total_tests_ran_in_file | |
+ end | |
end | |
diff --git a/test/test_helper.rb b/test/test_helper.rb | |
index 82ada87..1b488be 100644 | |
--- a/test/test_helper.rb | |
+++ b/test/test_helper.rb | |
@@ -1,2 +1,21 @@ | |
require 'test/unit' | |
require File.dirname(__FILE__) + '/../lib/context' | |
+ | |
+class Test::Unit::TestCase | |
+ class << self | |
+ @@_test_run_count = Hash.new(0) | |
+ | |
+ def suite_with_count | |
+ s = suite_without_count | |
+ @@_test_run_count[__FILE__] += s.size | |
+ s | |
+ end | |
+ | |
+ alias_method :suite_without_count, :suite | |
+ alias_method :suite, :suite_with_count | |
+ | |
+ def total_tests_ran_in_file | |
+ @@_test_run_count[__FILE__] | |
+ end | |
+ end | |
+end | |
\ No newline at end of file | |
diff --git a/test/test_lifecycle.rb b/test/test_lifecycle.rb | |
index 6f4196f..f8905a3 100644 | |
--- a/test/test_lifecycle.rb | |
+++ b/test/test_lifecycle.rb | |
@@ -52,4 +52,8 @@ class TestLifecycle < Test::Unit::TestCase | |
assert_equal 1, @test.d | |
end | |
end | |
+ | |
+ def test_all_tests_get_run | |
+ assert_equal 6, self.class.total_tests_ran_in_file | |
+ end | |
end | |
diff --git a/test/test_modular_tests.rb b/test/test_modular_tests.rb | |
new file mode 100644 | |
index 0000000..e69de29 | |
diff --git a/test/test_shared.rb b/test/test_shared.rb | |
index 96f2058..415f3dc 100644 | |
--- a/test/test_shared.rb | |
+++ b/test/test_shared.rb | |
@@ -112,4 +112,8 @@ class TestTest < Test::Unit::TestCase | |
end | |
end | |
end | |
+ | |
+ def test_all_tests_get_run | |
+ assert_equal 12, self.class.total_tests_ran_in_file | |
+ end | |
end | |
diff --git a/test/test_test.rb b/test/test_test.rb | |
index c9a6951..c44062c 100644 | |
--- a/test/test_test.rb | |
+++ b/test/test_test.rb | |
@@ -14,4 +14,8 @@ class TestTest < Test::Unit::TestCase | |
assert self.respond_to?(:test_a_test_block_should_create_a_test_method) | |
end | |
end | |
+ | |
+ def test_all_tests_get_run | |
+ assert_equal 3, self.class.total_tests_ran_in_file | |
+ end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment