summaryrefslogtreecommitdiff
blob: 07bc58f3f8d20c102c7fa121f38da02cb557e15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
commit 0757380fb62bc80ab7f1867b36d8a8b77ad3ed5f
Author: Simon Jesenko <simon.jesenko@gmail.com>
Date:   Fri Jul 18 08:00:52 2014 +0200

    fixing tests, substituting ActiveRecord::TestCase with ActiveSupport::TestCase

diff --git a/test/helper.rb b/test/helper.rb
index b30895f..b0a647e 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,6 +1,6 @@
 require 'minitest/autorun'
 require 'active_record'
-
+require 'rails'
 require 'rails/observers/activerecord/active_record'
 
 FIXTURES_ROOT = File.expand_path(File.dirname(__FILE__)) + "/fixtures"
@@ -68,7 +68,3 @@ end
 
 class Minimalistic < ActiveRecord::Base
 end
-
-ActiveSupport::Deprecation.silence do
-  require 'active_record/test_case'
-end
diff --git a/test/lifecycle_test.rb b/test/lifecycle_test.rb
index 5129670..fb55206 100644
--- a/test/lifecycle_test.rb
+++ b/test/lifecycle_test.rb
@@ -118,7 +118,7 @@ class AroundTopicObserver < ActiveRecord::Observer
   end
 end
 
-class LifecycleTest < ActiveRecord::TestCase
+class LifecycleTest < ActiveSupport::TestCase
   fixtures :topics, :developers, :minimalistics
 
   def test_before_destroy
diff --git a/test/observing_test.rb b/test/observing_test.rb
index a7f63dc..120d531 100644
--- a/test/observing_test.rb
+++ b/test/observing_test.rb
@@ -32,6 +32,16 @@ end
 class ObservingTest < ActiveModel::TestCase
   def setup
     ObservedModel.observers.clear
+    FooObserver.singleton_class.instance_eval do
+      alias_method :original_observed_classes, :observed_classes
+    end
+  end
+
+  def teardown
+    FooObserver.singleton_class.instance_eval do
+      undef_method :observed_classes
+      alias_method :observed_classes, :original_observed_classes
+    end
   end
 
   test "initializes model with no cached observers" do
diff --git a/test/transaction_callbacks_test.rb b/test/transaction_callbacks_test.rb
index 8f14cd3..30cbb03 100644
--- a/test/transaction_callbacks_test.rb
+++ b/test/transaction_callbacks_test.rb
@@ -1,6 +1,6 @@
 require "helper"
 
-class TransactionCallbacksTest < ActiveRecord::TestCase
+class TransactionCallbacksTest < ActiveSupport::TestCase
   self.use_transactional_fixtures = false
   fixtures :topics