diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-11-12 16:24:09 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-11-12 16:24:09 +0100 |
commit | 19398ab98af04eedb2574890ed0d8ecdf82ebb4c (patch) | |
tree | 8e2c0d2052136b82c7d8664dc146c9791fa7b4d8 /activerecord/test/cases/adapters/postgresql/schema_test.rb | |
parent | 53d04697d5c9450ecb5b7f37bdf0d5f12dd5ded5 (diff) | |
parent | 7429633b824cf8aaeea52d11876e7bd2b8d2f256 (diff) | |
download | rails-19398ab98af04eedb2574890ed0d8ecdf82ebb4c.tar.gz rails-19398ab98af04eedb2574890ed0d8ecdf82ebb4c.tar.bz2 rails-19398ab98af04eedb2574890ed0d8ecdf82ebb4c.zip |
Merge pull request #21601 from yui-knk/fix/ar_tables_without_view2
All `AR::ConnectionAdapters#tables` return only tables(exclude views)
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/schema_test.rb')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/schema_test.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index 93e98ec872..7c9169f6e2 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -184,42 +184,42 @@ class SchemaTest < ActiveRecord::PostgreSQLTestCase @connection.exec_query("alter table developers drop column zomg", 'sql', []) if altered end - def test_table_exists? + def test_data_source_exists? [Thing1, Thing2, Thing3, Thing4].each do |klass| name = klass.table_name - assert @connection.table_exists?(name), "'#{name}' table should exist" + assert @connection.data_source_exists?(name), "'#{name}' data_source should exist" end end - def test_table_exists_when_on_schema_search_path + def test_data_source_exists_when_on_schema_search_path with_schema_search_path(SCHEMA_NAME) do - assert(@connection.table_exists?(TABLE_NAME), "table should exist and be found") + assert(@connection.data_source_exists?(TABLE_NAME), "data_source should exist and be found") end end - def test_table_exists_when_not_on_schema_search_path + def test_data_source_exists_when_not_on_schema_search_path with_schema_search_path('PUBLIC') do - assert(!@connection.table_exists?(TABLE_NAME), "table exists but should not be found") + assert(!@connection.data_source_exists?(TABLE_NAME), "data_source exists but should not be found") end end - def test_table_exists_wrong_schema - assert(!@connection.table_exists?("foo.things"), "table should not exist") + def test_data_source_exists_wrong_schema + assert(!@connection.data_source_exists?("foo.things"), "data_source should not exist") end - def test_table_exists_quoted_names + def test_data_source_exists_quoted_names [ %("#{SCHEMA_NAME}"."#{TABLE_NAME}"), %(#{SCHEMA_NAME}."#{TABLE_NAME}"), %(#{SCHEMA_NAME}."#{TABLE_NAME}")].each do |given| - assert(@connection.table_exists?(given), "table should exist when specified as #{given}") + assert(@connection.data_source_exists?(given), "data_source should exist when specified as #{given}") end with_schema_search_path(SCHEMA_NAME) do given = %("#{TABLE_NAME}") - assert(@connection.table_exists?(given), "table should exist when specified as #{given}") + assert(@connection.data_source_exists?(given), "data_source should exist when specified as #{given}") end end - def test_table_exists_quoted_table + def test_data_source_exists_quoted_table with_schema_search_path(SCHEMA_NAME) do - assert(@connection.table_exists?('"things.table"'), "table should exist") + assert(@connection.data_source_exists?('"things.table"'), "data_source should exist") end end |