diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-09-22 15:58:18 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-09-22 19:48:44 +0200 |
commit | 152b85f06c7f91b39de0e5da6426feb35a698d05 (patch) | |
tree | 323b1b7cdd5b81b406ac59542668acd7ca81cf46 /activerecord/test/cases/connection_adapters/schema_cache_test.rb | |
parent | 1165e9c898a17fadf8f91986ba2f25fb47651d53 (diff) | |
download | rails-152b85f06c7f91b39de0e5da6426feb35a698d05.tar.gz rails-152b85f06c7f91b39de0e5da6426feb35a698d05.tar.bz2 rails-152b85f06c7f91b39de0e5da6426feb35a698d05.zip |
introduce `conn.data_source_exists?` and `conn.data_sources`.
These new methods are used from the Active Record model layer to
determine which relations are viable to back a model. These new methods
allow us to change `conn.tables` in the future to only return tables and
no views. Same for `conn.table_exists?`.
The goal is to provide the following introspection methods on the
connection:
* `tables`
* `table_exists?`
* `views`
* `view_exists?`
* `data_sources` (views + tables)
* `data_source_exists?` (views + tables)
Diffstat (limited to 'activerecord/test/cases/connection_adapters/schema_cache_test.rb')
-rw-r--r-- | activerecord/test/cases/connection_adapters/schema_cache_test.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/test/cases/connection_adapters/schema_cache_test.rb b/activerecord/test/cases/connection_adapters/schema_cache_test.rb index c7531f5418..db832fe55d 100644 --- a/activerecord/test/cases/connection_adapters/schema_cache_test.rb +++ b/activerecord/test/cases/connection_adapters/schema_cache_test.rb @@ -29,7 +29,7 @@ module ActiveRecord def test_clearing @cache.columns('posts') @cache.columns_hash('posts') - @cache.tables('posts') + @cache.data_sources('posts') @cache.primary_keys('posts') @cache.clear! @@ -40,17 +40,22 @@ module ActiveRecord def test_dump_and_load @cache.columns('posts') @cache.columns_hash('posts') - @cache.tables('posts') + @cache.data_sources('posts') @cache.primary_keys('posts') @cache = Marshal.load(Marshal.dump(@cache)) assert_equal 11, @cache.columns('posts').size assert_equal 11, @cache.columns_hash('posts').size - assert @cache.tables('posts') + assert @cache.data_sources('posts') assert_equal 'id', @cache.primary_keys('posts') end + def test_table_methods_deprecation + assert_deprecated { assert @cache.table_exists?('posts') } + assert_deprecated { assert @cache.tables('posts') } + assert_deprecated { @cache.clear_table_cache!('posts') } + end end end end |