@@ -5,23 +5,33 @@ class MSSQLIgnoreSystemViewsTest < Test::Unit::TestCase
55 include MigrationSetup
66
77 def test_system_views_ignored
8+ assert_not_include tables , 'views'
89 if ActiveRecord ::Base . connection . sqlserver_version == "2000"
9- assert_equal false , table_exists? ( "sys.views" ) , %{table_exists?("sys.views")}
10- assert_equal false , table_exists? ( "information_schema.views" ) , %{table_exists?("information_schema.views")}
10+ assert_false table_exists? ( "sys.views" ) , %{table_exists?("sys.views")}
11+ assert_false table_exists? ( "information_schema.views" ) , %{table_exists?("information_schema.views")}
1112 else
12- assert_equal true , table_exists? ( "sys.views" ) , %{table_exists?("sys.views")}
13- assert_equal true , table_exists? ( "information_schema.views" ) , %{table_exists?("information_schema.views")}
13+ assert_true table_exists? ( "sys.views" ) , %{table_exists?("sys.views")}
14+ assert_true table_exists? ( "information_schema.views" ) , %{table_exists?("information_schema.views")}
15+
16+ assert_true table_exists? ( :views ) , %{table_exists?(:views)}
1417 end
15- assert_equal false , table_exists? ( "dbo.views" ) , %{table_exists?("dbo.views")}
16- assert_equal false , table_exists? ( :views ) , %{table_exists?(:views)}
18+ assert_false table_exists? ( "dbo.views" ) , %{table_exists?("dbo.views")}
19+ #assert_false table_exists?(:views), %{table_exists?(:views)}
1720 ActiveRecord ::Schema . define { suppress_messages { create_table :views } }
18- assert_equal true , table_exists? ( :views ) , %{table_exists?(:views)}
21+ assert_include tables , 'views'
22+ assert_true table_exists? ( :views ) , %{table_exists?(:views)}
1923 ActiveRecord ::Schema . define { suppress_messages { drop_table :views } }
20- assert_equal false , table_exists? ( :views ) , %{table_exists?(:views)}
24+ #assert_false table_exists?(:views), %{table_exists?(:views)}
25+ ensure
26+ ActiveRecord ::Base . connection . drop_table ( :views ) rescue nil
2127 end
2228
2329 private
2430
31+ def tables
32+ ActiveRecord ::Base . connection . tables
33+ end
34+
2535 def table_exists? ( *args )
2636 ActiveRecord ::Base . connection . table_exists? ( *args )
2737 end
0 commit comments