Installing gems for testing
===========================

Remove your .bundle/config if you've already installed Redmine without
the test dependencies. Then, run `bundle install`.

Running Tests
=============

Run `rake --tasks test` to see available tests.
Run `rake test` to run the entire test suite (except the tests for the
Apache perl module Redmine.pm and Capybara tests, see below).

You can run `ruby test/unit/issue_test.rb` for running a single test case and
`ruby test/unit/issue_test.rb -n test_create` for running a single test.

Before running tests, you need to configure both development
and test databases.

Creating test repositories
==========================

Redmine supports a wide array of different version control systems.
To test the support, a test repository needs to be created for each of those.

Run `rake --tasks test:scm:setup` for a list of available test-repositories or
run `rake test:scm:setup:all` to set up all of them. The repositories are
unpacked into {redmine_root}/tmp/test.

If the test repositories are not present, the tests that need them will be
skipped.

Creating a test LDAP database
=============================

Redmine supports using LDAP for user authentications.  To test LDAP
with Redmine, load the LDAP export from test/fixtures/ldap/test-ldap.ldif
into a testing LDAP server. Make sure that the LDAP server can be accessed
at 127.0.0.1 on port 389.

If your LDAP server is not running on localhost, you can use the
REDMINE_TEST_LDAP_SERVER environment variable to specify another host.

Setting up the test LDAP server is beyond the scope of this documentation.
The OpenLDAP project provides a simple LDAP implementation that should work
good as a test server.

If the LDAP is not available, the tests that need it will be skipped.

Running Redmine.pm tests
========================

(work in progress)

Running the tests for the Redmine.pm perl module needs a bit more setup.
You need an Apache server with mod_perl, mod_dav_svn and Redmine.pm configured.
See: http://www.redmine.org/projects/redmine/wiki/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl

You need an empty repository accessible at http://127.0.0.1/svn/ecookbook
Then, you can run the tests with:
`ruby test\extra\redmine_pm\repository_subversion_test.rb`

If your svn server is not running on localhost, you can use the
REDMINE_TEST_DAV_SERVER environment variable to specify another host.

Running Capybara tests
======================

You need to have ChromeDriver installed and available in your PATH:
https://sites.google.com/a/chromium.org/chromedriver/

Capybara tests can be run with:
`rails test:system`

Running RuboCop, a static code analyzer
=======================================

RuboCop allows you to find out if the code violates the Ruby Style Guide.
Checking with RuboCop is recommended when you write patches.

You can run RuboCop with:
`bundle exec rubocop [file ...]`
