Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An easy way to run tests on a gem?

Is there a quick and easy way to test a gem which is already installed locally? Like:

gem test gem_name_to_test

rubygems docs says one can put gem: --run-tests in ~/.gemrc file to run unit tests when a gem is installed. I could not make it work though and that is not exactly what I need.

like image 403
Evgenii Avatar asked Dec 21 '11 07:12

Evgenii


2 Answers

You can navigate to the place the gem lives and run tests from there, so for example:

$ cd ~/.rvm/gems/ruby-1.9.2-p290/gems/awesome_print-0.4.0
$ rake spec

Note that additional dependencies may need to be installed via bundler or gem

like image 99
Paweł Obrok Avatar answered Sep 20 '22 18:09

Paweł Obrok


There is "gem test" command, which may or may not be what you are looking for. It run tests agains the package and sends them to test.rubygems.org.

gem install rubygems-test
gem test gem_name_to_test
like image 29
Tatu Lahtela Avatar answered Sep 20 '22 18:09

Tatu Lahtela