TESTING
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Testing
==============
Tests are written with Shoulda on top of Test::Unit and Factory Girl is used instead of fixtures. Tests are run using rake.
Test can either be run against a MySQL database or the faster in-memory SQLite3.
MySQL
=======
1. Create a new Rails app.
2. Install acts_as_follower as a plugin.
3. Copy the database config within the plugin:
cp test/database.yml.example test/database.yml
4. Create a database as specified in test/database.yml.
5. Run the tests:
rake test
SQLite3
=======
1. Create a new Rails app.
2. Install acts_as_follower as a plugin.
3. Copy the database config within the plugin:
cp test/database.yml.example test/database.yml
4. Install the sqlite3 library (if you don't have it already):
sudo gem install sqlite3-ruby
5. Run the tests:
DB=sqlite3 rake test
Coverage
=======
Test coverage can be calculated using Rcov. Make sure you have the rcov gem installed.
Again in the acts_as_follower directory:
rake rcov:gen # For mysql
or:
rake rcov:gen DB=sqlite3 # For sqlite
The coverage will now be available in the test/coverage directory.
rake rcov:clobber will delete the coverage directory.