aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/active_schema_test_postgresql.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-04-01 05:01:10 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-04-01 05:01:10 +0000
commite4e3df8ef8b198416fedc80743caf37c5aaff9fb (patch)
tree56f26406f068a21ffc863ae6c179f59c5b1ca2b6 /activerecord/test/cases/active_schema_test_postgresql.rb
parentdc1166d12bbe4f5b65862f4d46cd0ab98141b1cb (diff)
downloadrails-e4e3df8ef8b198416fedc80743caf37c5aaff9fb.tar.gz
rails-e4e3df8ef8b198416fedc80743caf37c5aaff9fb.tar.bz2
rails-e4e3df8ef8b198416fedc80743caf37c5aaff9fb.zip
PostgreSQL: create_ and drop_database support. Closes #9042.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9182 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases/active_schema_test_postgresql.rb')
-rw-r--r--activerecord/test/cases/active_schema_test_postgresql.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/test/cases/active_schema_test_postgresql.rb b/activerecord/test/cases/active_schema_test_postgresql.rb
new file mode 100644
index 0000000000..db325e3fb4
--- /dev/null
+++ b/activerecord/test/cases/active_schema_test_postgresql.rb
@@ -0,0 +1,24 @@
+require 'cases/helper'
+
+class PostgresqlActiveSchemaTest < Test::Unit::TestCase
+ def setup
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
+ alias_method :real_execute, :execute
+ def execute(sql, name = nil) sql end
+ end
+ end
+
+ def teardown
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:alias_method, :execute, :real_execute)
+ end
+
+ def test_create_database_with_encoding
+ assert_equal "CREATE DATABASE matt ENCODING = 'utf8'", create_database(:matt)
+ assert_equal "CREATE DATABASE aimonetti ENCODING = 'latin1'", create_database(:aimonetti, :encoding => :latin1)
+ end
+
+ private
+ def method_missing(method_symbol, *arguments)
+ ActiveRecord::Base.connection.send(method_symbol, *arguments)
+ end
+end