aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorTravis Jeffery <travisjeffery@gmail.com>2012-03-07 05:14:35 +0000
committerTravis Jeffery <travisjeffery@gmail.com>2012-03-07 17:55:33 +0000
commit8dc1a625c87950f4b258b7f6fc1036e08b192daa (patch)
treed60bcf733d3a140e0910b5422dc1427ef6bcd469 /activerecord/test
parent577971f05a838da3ba74ba49d776a83f6bfe1aee (diff)
downloadrails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.tar.gz
rails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.tar.bz2
rails-8dc1a625c87950f4b258b7f6fc1036e08b192daa.zip
Adds #create/drop_schema on the PostgreSQL Adapter.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb39
1 files changed, 37 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index 1c56dd76f6..9208f53997 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -75,6 +75,41 @@ class SchemaTest < ActiveRecord::TestCase
assert_equal ["public", "test_schema", "test_schema2"], @connection.schema_names
end
+ def test_create_schema
+ begin
+ @connection.create_schema "test_schema3"
+ assert @connection.schema_names.include? "test_schema3"
+ ensure
+ @connection.drop_schema "test_schema3"
+ end
+ end
+
+ def test_raise_create_schema_with_existing_schema
+ begin
+ @connection.create_schema "test_schema3"
+ assert_raises(ActiveRecord::StatementInvalid) do
+ @connection.create_schema "test_schema3"
+ end
+ ensure
+ @connection.drop_schema "test_schema3"
+ end
+ end
+
+ def test_drop_schema
+ begin
+ @connection.create_schema "test_schema3"
+ ensure
+ @connection.drop_schema "test_schema3"
+ end
+ assert !@connection.schema_names.include?("test_schema3")
+ end
+
+ def test_raise_drop_schema_with_nonexisting_schema
+ assert_raises(ActiveRecord::StatementInvalid) do
+ @connection.drop_schema "test_schema3"
+ end
+ end
+
def test_schema_change_with_prepared_stmt
altered = false
@connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
@@ -187,13 +222,13 @@ class SchemaTest < ActiveRecord::TestCase
end
def test_raise_on_unquoted_schema_name
- assert_raise(ActiveRecord::StatementInvalid) do
+ assert_raises(ActiveRecord::StatementInvalid) do
with_schema_search_path '$user,public'
end
end
def test_without_schema_search_path
- assert_raise(ActiveRecord::StatementInvalid) { columns(TABLE_NAME) }
+ assert_raises(ActiveRecord::StatementInvalid) { columns(TABLE_NAME) }
end
def test_ignore_nil_schema_search_path