Celogeek Wiki

It seems that you use Adblock or an adblocker on my site. Ads help me to provide this site and keep it on a high speed and quality level. Please add my site on your white list. Thanks.

Test your project

This command will run all test below :

rake test

Test your project step by step

Database prepare

First, create test database. Use your config to find the name. We call it “db_test” for example.

CREATE DATABASE db_test;

Clone the production tables :

rake db:test:prepare

Load data

Load fixtures from test/fixtures

RAILS_ENV=test rake db:fixtures:load -t

Any named files here has its corresponding table in the test database.

Example :

  • file : achats.yml ⇒ table : db_test.achats

Pay attention to have a perfectly valid yml file. Otherwise any further test will fail loudly.

Run unit test

ruby -Itest test/unit/your_test.rb

Navigation