diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-21 12:03:11 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-09-21 12:03:16 -0700 |
commit | 78b30fed9336336694fb2cb5d2825f95800b541c (patch) | |
tree | b3bb786dfd966d42988b87dee9ec8c56c45a4e44 /activerecord/test | |
parent | 68bd4db190fea5aad213886898e3d541f8de6fa5 (diff) | |
download | rails-78b30fed9336336694fb2cb5d2825f95800b541c.tar.gz rails-78b30fed9336336694fb2cb5d2825f95800b541c.tar.bz2 rails-78b30fed9336336694fb2cb5d2825f95800b541c.zip |
Correct default charset/collation for mysql dbs
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/tasks/mysql_rake_test.rb | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index 46b97a1274..97d283bf14 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -20,20 +20,32 @@ module ActiveRecord ActiveRecord::Tasks::DatabaseTasks.create @configuration end - def test_creates_database_with_default_options + def test_creates_database_with_default_encoding_and_collation @connection.expects(:create_database). - with('my-app-db', {:charset => 'utf8', :collation => 'utf8_unicode_ci'}) + with('my-app-db', charset: 'utf8', collation: 'utf8_unicode_ci') ActiveRecord::Tasks::DatabaseTasks.create @configuration end - def test_creates_database_with_given_options + def test_creates_database_with_given_encoding_and_default_collation @connection.expects(:create_database). - with('my-app-db', {:charset => 'latin', :collation => 'latin_ci'}) + with('my-app-db', charset: 'utf8', collation: 'utf8_unicode_ci') - ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge( - 'encoding' => 'latin', 'collation' => 'latin_ci' - ) + ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge('encoding' => 'utf8') + end + + def test_creates_database_with_given_encoding_and_no_collation + @connection.expects(:create_database). + with('my-app-db', charset: 'latin1') + + ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge('encoding' => 'latin1') + end + + def test_creates_database_with_given_collation_and_no_encoding + @connection.expects(:create_database). + with('my-app-db', collation: 'latin1_swedish_ci') + + ActiveRecord::Tasks::DatabaseTasks.create @configuration.merge('collation' => 'latin1_swedish_ci') end def test_establishes_connection_to_database @@ -166,14 +178,14 @@ module ActiveRecord def test_recreates_database_with_the_default_options @connection.expects(:recreate_database). - with('test-db', {:charset => 'utf8', :collation => 'utf8_unicode_ci'}) + with('test-db', { :charset => 'utf8', :collation => 'utf8_unicode_ci' }) ActiveRecord::Tasks::DatabaseTasks.purge @configuration end def test_recreates_database_with_the_given_options @connection.expects(:recreate_database). - with('test-db', {:charset => 'latin', :collation => 'latin_ci'}) + with('test-db', { :charset => 'latin', :collation => 'latin_ci' }) ActiveRecord::Tasks::DatabaseTasks.purge @configuration.merge( 'encoding' => 'latin', 'collation' => 'latin_ci' |