Running tests

Most Ruby libraries contain code to test the functionality provided by the library and compare results with known inputs. It is recommended that these tests are run during the package building so that the functionality of the package may be confirmed. There are many testing frameworks available in Ruby, the leading ones in usage being RSpec and Minitest.

Recent versions of gem2deb automatically identifies the Testing framework, and create debian/ruby-tests.rake file automatically to run the tests. This is done by analysing the test or spec directory present in the upstream source.

Upstream gem file doesn't contain tests

Chances are there the upstream developers didn't include the tests they use in the gem file they provide. This is justified by the fact that end users doesn't often require and bother to run theses tests. There are two scenarios associated with this - tests are present in upstream code repository, tests are nowhere available.

Upstream repo contains the tests

If the upstream repo contains the tests and it is only the gem file that is missing them, the solution is pretty simple. Instead of using the gem file from the Rubygems, we provide the tarball that is provided in the upstream repo. The steps are (taking the gem akismet as example)

1. Download the tarball provided by upstream. Most of the Ruby libraries are hosted in Github and they provide tarballs from their releases page. They can be downloaded from there. For example,

$ wget

2. Rename the tarball to <gemname>-<version>.tar.gz

$ mv v2.0.0.tar.gz akismet-2.0.0.tar.gz

3. Run gem2deb <tarball name>

$ gem2deb akismet-2.0.0.tar.gz

4. Change watch file inside debian/directory to point to the upstream location as specified in debian/watch

5. Continue as you do for normal package from step 3.1 of packaging

No tests are available, even in the upstream repo

If the upstream doesn't provide any tests, even in their repo, you can either

1. file a bug upstream to add necessary tests or

2. if you are knowledgable about the gem you can write your own tests, add them as patch and forward to upstream so that they can also use it.

Test Failures