aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/view_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-09-22 15:58:18 +0200
committerYves Senn <yves.senn@gmail.com>2015-09-22 19:48:44 +0200
commit152b85f06c7f91b39de0e5da6426feb35a698d05 (patch)
tree323b1b7cdd5b81b406ac59542668acd7ca81cf46 /activerecord/test/cases/view_test.rb
parent1165e9c898a17fadf8f91986ba2f25fb47651d53 (diff)
downloadrails-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/view_test.rb')
-rw-r--r--activerecord/test/cases/view_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb
index d7b3e223ed..e80d8bd584 100644
--- a/activerecord/test/cases/view_test.rb
+++ b/activerecord/test/cases/view_test.rb
@@ -44,9 +44,15 @@ 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"
end
+ def test_views_ara_valid_data_sources
+ view_name = Ebook.table_name
+ assert @connection.data_source_exists?(view_name), "'#{view_name}' should be a data source"
+ end
+
def test_column_definitions
assert_equal([["id", :integer],
["name", :string],