diff options
author | Ben Marini <bmarini@gmail.com> | 2010-01-24 15:01:22 -0800 |
---|---|---|
committer | Ben Marini <bmarini@gmail.com> | 2010-01-24 15:01:22 -0800 |
commit | c5211c28e2d1aab3d74f91563b176c7b63f5c9f1 (patch) | |
tree | c2e1b592831c778256c4fcf2af7ba79f198a546e /railties/guides/source/contributing_to_rails.textile | |
parent | 5742a72b8a116e4f4e387ab345d62ac3215c3bba (diff) | |
download | rails-c5211c28e2d1aab3d74f91563b176c7b63f5c9f1.tar.gz rails-c5211c28e2d1aab3d74f91563b176c7b63f5c9f1.tar.bz2 rails-c5211c28e2d1aab3d74f91563b176c7b63f5c9f1.zip |
Updated instructions on how to create test databases with proper encoding [#97]
Diffstat (limited to 'railties/guides/source/contributing_to_rails.textile')
-rw-r--r-- | railties/guides/source/contributing_to_rails.textile | 21 |
1 files changed, 14 insertions, 7 deletions
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: |