aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2015-09-13 20:03:30 +0900
committerRyuta Kamizono <kamipo@gmail.com>2015-09-13 21:02:43 +0900
commitdcd39949f8801cb4beddec37143a585259f09a2d (patch)
treed27bca5fe39f2c587fa3919b6781e8c30bc3b144 /activerecord/test
parent602ec7a4a21846db74f0371eb27784f19f80e28c (diff)
downloadrails-dcd39949f8801cb4beddec37143a585259f09a2d.tar.gz
rails-dcd39949f8801cb4beddec37143a585259f09a2d.tar.bz2
rails-dcd39949f8801cb4beddec37143a585259f09a2d.zip
Add `#views` and `#view_exists?` methods on connection adapters
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/view_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/view_test.rb b/activerecord/test/cases/view_test.rb
index 1eb1430065..43785874b0 100644
--- a/activerecord/test/cases/view_test.rb
+++ b/activerecord/test/cases/view_test.rb
@@ -31,6 +31,15 @@ module ViewBehavior
assert_equal ["Ruby for Rails"], books.map(&:name)
end
+ def test_views
+ assert_equal [Ebook.table_name], @connection.views
+ end
+
+ def test_view_exists
+ view_name = Ebook.table_name
+ assert @connection.view_exists?(view_name), "'#{view_name}' view should exist"
+ end
+
def test_table_exists
view_name = Ebook.table_name
assert @connection.table_exists?(view_name), "'#{view_name}' table should exist"
@@ -91,6 +100,15 @@ class ViewWithoutPrimaryKeyTest < ActiveRecord::TestCase
assert_equal ["Agile Web Development with Rails"], books.map(&:name)
end
+ def test_views
+ assert_equal [Paperback.table_name], @connection.views
+ end
+
+ def test_view_exists
+ view_name = Paperback.table_name
+ assert @connection.view_exists?(view_name), "'#{view_name}' view should exist"
+ end
+
def test_table_exists
view_name = Paperback.table_name
assert @connection.table_exists?(view_name), "'#{view_name}' table should exist"