aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-05-19 12:20:30 +0200
committerYves Senn <yves.senn@gmail.com>2014-05-19 12:20:30 +0200
commitd4cec3124085ee7070986d13e9e44664d0aa9d2a (patch)
treeba3f5c46439ab2b74d48c7aa86a876ed77455011 /activerecord/test/cases/adapters/postgresql
parent881cab448c698dde1d698ea8ad048561c6bcf702 (diff)
downloadrails-d4cec3124085ee7070986d13e9e44664d0aa9d2a.tar.gz
rails-d4cec3124085ee7070986d13e9e44664d0aa9d2a.tar.bz2
rails-d4cec3124085ee7070986d13e9e44664d0aa9d2a.zip
pg, re-introduce `PostgreSQL::Utils` to unify schema/table extraction.
Partial revert of c0bfc3f412834ffe8327a15ae3a46602cc28e425
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb15
-rw-r--r--activerecord/test/cases/adapters/postgresql/utils_test.rb20
2 files changed, 20 insertions, 15 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index 9d4d79c0c6..11ec7599a3 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -352,21 +352,6 @@ class SchemaTest < ActiveRecord::TestCase
end
end
- def test_extract_schema_and_table
- {
- %(table_name) => [nil,'table_name'],
- %("table.name") => [nil,'table.name'],
- %(schema.table_name) => %w{schema table_name},
- %("schema".table_name) => %w{schema table_name},
- %(schema."table_name") => %w{schema table_name},
- %("schema"."table_name") => %w{schema table_name},
- %("even spaces".table) => ['even spaces','table'],
- %(schema."table.name") => ['schema', 'table.name']
- }.each do |given, expect|
- assert_equal expect, @connection.send(:extract_schema_and_table, given)
- end
- end
-
private
def columns(table_name)
@connection.send(:column_definitions, table_name).map do |name, type, default|
diff --git a/activerecord/test/cases/adapters/postgresql/utils_test.rb b/activerecord/test/cases/adapters/postgresql/utils_test.rb
new file mode 100644
index 0000000000..e6d7868e9a
--- /dev/null
+++ b/activerecord/test/cases/adapters/postgresql/utils_test.rb
@@ -0,0 +1,20 @@
+require 'cases/helper'
+
+class PostgreSQLUtilsTest < ActiveSupport::TestCase
+ include ActiveRecord::ConnectionAdapters::PostgreSQL::Utils
+
+ def test_extract_schema_and_table
+ {
+ %(table_name) => [nil,'table_name'],
+ %("table.name") => [nil,'table.name'],
+ %(schema.table_name) => %w{schema table_name},
+ %("schema".table_name) => %w{schema table_name},
+ %(schema."table_name") => %w{schema table_name},
+ %("schema"."table_name") => %w{schema table_name},
+ %("even spaces".table) => ['even spaces','table'],
+ %(schema."table.name") => ['schema', 'table.name']
+ }.each do |given, expect|
+ assert_equal expect, extract_schema_and_table(given)
+ end
+ end
+end