diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:20:37 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-26 00:20:37 +0000 |
commit | ed2a84f99b75ed0c2dec4a0145720ee84ab9e114 (patch) | |
tree | a5ae8afccd4ba117b7ea38364cd45c05a60b29f1 /activerecord/test/active_schema_test_mysql.rb | |
parent | 79212def83c0c4fb6299f019988963212fe6664c (diff) | |
download | rails-ed2a84f99b75ed0c2dec4a0145720ee84ab9e114.tar.gz rails-ed2a84f99b75ed0c2dec4a0145720ee84ab9e114.tar.bz2 rails-ed2a84f99b75ed0c2dec4a0145720ee84ab9e114.zip |
MySQL: create_database takes :charset and :collation options. Charset defaults to utf8. References #8448.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/active_schema_test_mysql.rb')
-rw-r--r-- | activerecord/test/active_schema_test_mysql.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/activerecord/test/active_schema_test_mysql.rb b/activerecord/test/active_schema_test_mysql.rb index b72223526a..d7a20f9338 100644 --- a/activerecord/test/active_schema_test_mysql.rb +++ b/activerecord/test/active_schema_test_mysql.rb @@ -5,9 +5,9 @@ class ActiveSchemaTest < Test::Unit::TestCase ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do alias_method :real_execute, :execute def execute(sql, name = nil) return sql end - end + end end - + def teardown ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:alias_method, :execute, :real_execute) end @@ -15,17 +15,25 @@ class ActiveSchemaTest < Test::Unit::TestCase def test_drop_table assert_equal "DROP TABLE people", drop_table(:people) end - + + if current_adapter?(:MysqlAdapter) + def test_create_mysql_database_with_encoding + assert_equal "CREATE DATABASE `matt` DEFAULT CHARACTER SET `utf8`", create_database(:matt) + assert_equal "CREATE DATABASE `aimonetti` DEFAULT CHARACTER SET `latin1`", create_database(:aimonetti, {:charset => 'latin1'}) + assert_equal "CREATE DATABASE `matt_aimonetti` DEFAULT CHARACTER SET `big5` COLLATE `big5_chinese_ci`", create_database(:matt_aimonetti, {:charset => :big5, :collation => :big5_chinese_ci}) + end + end + def test_add_column assert_equal "ALTER TABLE people ADD `last_name` varchar(255)", add_column(:people, :last_name, :string) end - + def test_add_column_with_limit assert_equal "ALTER TABLE people ADD `key` varchar(32)", add_column(:people, :key, :string, :limit => 32) end - + private def method_missing(method_symbol, *arguments) ActiveRecord::Base.connection.send(method_symbol, *arguments) end -end
\ No newline at end of file +end |