Skip to content
This repository
Browse code

Revert "make TestCaseTest work for pre-1.9 rubies, too"

This reverts commit 8378a44.
  • Loading branch information...
commit 3afa5385c929acb9f7cb9801da32e06cb4af101b 1 parent c545331
Jamis Buck authored January 19, 2011

Showing 1 changed file with 25 additions and 46 deletions. Show diff stats Hide diff stats

  1. 71  activesupport/test/test_case_test.rb
71  activesupport/test/test_case_test.rb
@@ -2,8 +2,6 @@
2 2
 
3 3
 module ActiveSupport
4 4
   class TestCaseTest < ActiveSupport::TestCase
5  
-    IS_MINITEST = defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions 
6  
-
7 5
     class FakeRunner
8 6
       attr_reader :puked
9 7
 
@@ -14,65 +12,46 @@ def initialize
14 12
       def puke(klass, name, e)
15 13
         @puked << [klass, name, e]
16 14
       end
17  
-
18  
-      unless IS_MINITEST
19  
-        def add_error(e)
20  
-          puke(nil, nil, e)
21  
-        end
22  
-
23  
-        def add_run
24  
-        end
25  
-
26  
-        def add_assertion
27  
-        end
28  
-
29  
-        def add_failure(msg, locations=nil)
30  
-        end
31  
-      end
32 15
     end
33 16
 
34  
-    def test_callback_with_exception
35  
-      tc = Class.new(TestCase) do
36  
-        setup :bad_callback
37  
-        def bad_callback; raise 'oh noes' end
38  
-        def test_true; assert true end
39  
-      end
  17
+    if defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions
  18
+      def test_callback_with_exception
  19
+        tc = Class.new(TestCase) do
  20
+          setup :bad_callback
  21
+          def bad_callback; raise 'oh noes' end
  22
+          def test_true; assert true end
  23
+        end
40 24
 
41  
-      test_name = 'test_true'
42  
-      fr = FakeRunner.new
  25
+        test_name = 'test_true'
  26
+        fr = FakeRunner.new
43 27
 
44  
-      test = tc.new test_name
45  
-      test.run(fr) {}
46  
-      klass, name, exception = *fr.puked.first
  28
+        test = tc.new test_name
  29
+        test.run fr
  30
+        klass, name, exception = *fr.puked.first
47 31
 
48  
-      if IS_MINITEST
49 32
         assert_equal tc, klass
50 33
         assert_equal test_name, name
  34
+        assert_equal 'oh noes', exception.message
51 35
       end
52 36
 
53  
-      assert_match %r{oh noes}, exception.message
54  
-    end
55  
-
56  
-    def test_teardown_callback_with_exception
57  
-      tc = Class.new(TestCase) do
58  
-        teardown :bad_callback
59  
-        def bad_callback; raise 'oh noes' end
60  
-        def test_true; assert true end
61  
-      end
  37
+      def test_teardown_callback_with_exception
  38
+        tc = Class.new(TestCase) do
  39
+          teardown :bad_callback
  40
+          def bad_callback; raise 'oh noes' end
  41
+          def test_true; assert true end
  42
+        end
62 43
 
63  
-      test_name = 'test_true'
64  
-      fr = FakeRunner.new
  44
+        test_name = 'test_true'
  45
+        fr = FakeRunner.new
65 46
 
66  
-      test = tc.new test_name
67  
-      test.run(fr) {}
68  
-      klass, name, exception = *fr.puked.first
  47
+        test = tc.new test_name
  48
+        test.run fr
  49
+        klass, name, exception = *fr.puked.first
69 50
 
70  
-      if IS_MINITEST
71 51
         assert_equal tc, klass
72 52
         assert_equal test_name, name
  53
+        assert_equal 'oh noes', exception.message
73 54
       end
74  
-
75  
-      assert_match %r{oh noes}, exception.message
76 55
     end
77 56
   end
78 57
 end

0 notes on commit 3afa538

Please sign in to comment.
Something went wrong with that request. Please try again.