aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-03-28 11:01:15 +0430
committerRizwan Reza <rizwanreza@gmail.com>2010-03-28 11:01:15 +0430
commit6c2a0675f11a9b5b8e88ed7dbccd65cb51be8029 (patch)
treeed5ab51c378a43303e8e7f07ed01345857d0df7d /activerecord/test/cases
parent8398f21880a952769ccd6437a4344922fe596dab (diff)
downloadrails-6c2a0675f11a9b5b8e88ed7dbccd65cb51be8029.tar.gz
rails-6c2a0675f11a9b5b8e88ed7dbccd65cb51be8029.tar.bz2
rails-6c2a0675f11a9b5b8e88ed7dbccd65cb51be8029.zip
When creating database with rake, create schemas in schema_search_path if it doesn't exist.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/active_schema_test_postgresql.rb7
-rw-r--r--activerecord/test/cases/adapter_test.rb6
2 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/active_schema_test_postgresql.rb b/activerecord/test/cases/active_schema_test_postgresql.rb
index af80f724f2..67c662d694 100644
--- a/activerecord/test/cases/active_schema_test_postgresql.rb
+++ b/activerecord/test/cases/active_schema_test_postgresql.rb
@@ -17,6 +17,13 @@ class PostgresqlActiveSchemaTest < Test::Unit::TestCase
assert_equal %(CREATE DATABASE "aimonetti" ENCODING = 'latin1'), create_database(:aimonetti, :encoding => :latin1)
end
+ def test_create_schema
+ assert_equal %(CREATE SCHEMA "rizwan" AUTHORIZATION "postgres"), create_schema(:rizwan, :postgres)
+ end
+
+ def test_drop_schema
+ assert_equal %(DROP SCHEMA "rizwan"), drop_schema(:rizwan)
+ end
private
def method_missing(method_symbol, *arguments)
ActiveRecord::Base.connection.send(method_symbol, *arguments)
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb
index 9b28766405..9f78ae008c 100644
--- a/activerecord/test/cases/adapter_test.rb
+++ b/activerecord/test/cases/adapter_test.rb
@@ -81,6 +81,12 @@ class AdapterTest < ActiveRecord::TestCase
def test_encoding
assert_not_nil @connection.encoding
end
+
+ def test_all_schemas
+ @connection.create_schema(:test_schema, :postgres)
+ assert @connection.all_schemas.include?('test_schema')
+ @connection.drop_schema(:test_schema)
+ end
end
def test_table_alias