mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Updated instructions on how to create test databases with proper encoding [#97]
This commit is contained in:
parent
5742a72b8a
commit
c5211c28e2
1 changed files with 14 additions and 7 deletions
|
@ -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> 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';
|
||||
</shell>
|
||||
|
||||
Enter this from the +activerecord+ directory to create the test databases:
|
||||
|
||||
<shell>
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue