From c5211c28e2d1aab3d74f91563b176c7b63f5c9f1 Mon Sep 17 00:00:00 2001
From: Ben Marini <bmarini@gmail.com>
Date: Sun, 24 Jan 2010 15:01:22 -0800
Subject: Updated instructions on how to create test databases with proper
 encoding [#97]

---
 .../guides/source/contributing_to_rails.textile     | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

(limited to 'railties/guides/source/contributing_to_rails.textile')

diff --git a/railties/guides/source/contributing_to_rails.textile b/railties/guides/source/contributing_to_rails.textile
index 805fcf1a32..1b6823a39a 100644
--- a/railties/guides/source/contributing_to_rails.textile
+++ b/railties/guides/source/contributing_to_rails.textile
@@ -76,21 +76,28 @@ TIP: You may want to "put your git branch name in your shell prompt":http://gith
 h4. Set up and Run the Tests
 
 All of the Rails tests must pass with any code you submit, otherwise you have no chance of getting code accepted. This means you need to be able to run the tests. Rails needs the +mocha+ gem for running some tests, so install it with:
+
 <shell>
 gem install mocha
 </shell>
 
-For the tests that touch the database, this means creating the databases. If you're using MySQL:
+For the tests that touch the database, this means creating test databases. If you're using MySQL, create a user named +rails+ with privileges on the test databases.
+
+<shell>
+mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.*
+       to 'rails'@'localhost';
+mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.*
+       to 'rails'@'localhost';
+</shell>
+
+Enter this from the +activerecord+ directory to create the test databases:
 
 <shell>
-mysql> create database activerecord_unittest;  
-mysql> create database activerecord_unittest2;  
-mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.*  
-       to 'rails'@'localhost';  
-mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.*  
-       to 'rails'@'localhost';  
+rake mysql:build_databases
 </shell>
 
+NOTE: Using the rake task to create the test databases ensures they have the correct character set and collation.
+
 If you’re using another database, check the files under +activerecord/test/connections+ in the Rails source code for default connection information. You can edit these files if you _must_ on your machine to provide different credentials, but obviously you should not push any such changes back to Rails.
 
 Now if you go back to the root of the Rails source on your machine and run +rake+ with no parameters, you should see every test in all of the Rails components pass. If you want to run the all ActiveRecord tests (or just a single one) with another database adapter, enter this from the +activerecord+ directory:
-- 
cgit v1.2.3

