aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/view_test.rb
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2015-09-12 23:00:57 +0900
committeryui-knk <spiketeika@gmail.com>2015-11-09 23:13:23 +0900
commit7429633b824cf8aaeea52d11876e7bd2b8d2f256 (patch)
treeaad38b660d637c8d9578955eb136337e60fb2d03 /activerecord/test/cases/view_test.rb
parent16214d1108c31174c94503caced3855b0f6bad95 (diff)
downloadrails-7429633b824cf8aaeea52d11876e7bd2b8d2f256.tar.gz
rails-7429633b824cf8aaeea52d11876e7bd2b8d2f256.tar.bz2
rails-7429633b824cf8aaeea52d11876e7bd2b8d2f256.zip
Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`
Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
Diffstat (limited to 'activerecord/test/cases/view_test.rb')
-rw-r--r--activerecord/test/cases/view_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb
index e80d8bd584..d50ae74e35 100644
--- a/activerecord/test/cases/view_test.rb
+++ b/activerecord/test/cases/view_test.rb
@@ -45,7 +45,7 @@ module ViewBehavior
def test_table_exists
view_name = Ebook.table_name
# TODO: switch this assertion around once we changed #tables to not return views.
- assert @connection.table_exists?(view_name), "'#{view_name}' table should exist"
+ ActiveSupport::Deprecation.silence { assert @connection.table_exists?(view_name), "'#{view_name}' table should exist" }
end
def test_views_ara_valid_data_sources
@@ -87,7 +87,7 @@ class ViewWithPrimaryKeyTest < ActiveRecord::TestCase
end
def drop_view(name)
- @connection.execute "DROP VIEW #{name}" if @connection.table_exists? name
+ @connection.execute "DROP VIEW #{name}" if @connection.view_exists? name
end
end
@@ -106,7 +106,7 @@ class ViewWithoutPrimaryKeyTest < ActiveRecord::TestCase
end
teardown do
- @connection.execute "DROP VIEW paperbacks" if @connection.table_exists? "paperbacks"
+ @connection.execute "DROP VIEW paperbacks" if @connection.view_exists? "paperbacks"
end
def test_reading
@@ -125,7 +125,8 @@ class ViewWithoutPrimaryKeyTest < ActiveRecord::TestCase
def test_table_exists
view_name = Paperback.table_name
- assert @connection.table_exists?(view_name), "'#{view_name}' table should exist"
+ # TODO: switch this assertion around once we changed #tables to not return views.
+ ActiveSupport::Deprecation.silence { assert @connection.table_exists?(view_name), "'#{view_name}' table should exist" }
end
def test_column_definitions
@@ -167,7 +168,7 @@ class UpdateableViewTest < ActiveRecord::TestCase
end
teardown do
- @connection.execute "DROP VIEW printed_books" if @connection.table_exists? "printed_books"
+ @connection.execute "DROP VIEW printed_books" if @connection.view_exists? "printed_books"
end
def test_update_record
@@ -209,8 +210,7 @@ class MaterializedViewTest < ActiveRecord::PostgreSQLTestCase
end
def drop_view(name)
- @connection.execute "DROP MATERIALIZED VIEW #{name}" if @connection.table_exists? name
-
+ @connection.execute "DROP MATERIALIZED VIEW #{name}" if @connection.view_exists? name
end
end
end