Testing Gems

R

Ross Bamford

According to http://docs.rubygems.org/read/chapter/20#test_files, the
test_files section of the gemspec file lists test files that are loaded
"when
the user requests a gem to be unit tested".

Is there a gem command to run the tests? I can't see one listed in the
help,
but I may just be missing it.

Try something like:

$ gem install --test somegem

There is detail with:

$ gem help install
$ gem help examples

If the tests succeed, there's no output (at least by default?) but they do
run if they're there (after Rdoc I think).

Cheers,
 
R

Robin Stocker

Hi,

I recently had exactly the same question... So, maybe the Gemspec
Reference should be updated.

The install command has the --test or -t option.
Have a look at gem help install.

So, for example:
gem install examplegem --test

Robin
 
M

Mark Volkmann

Hi,

I recently had exactly the same question... So, maybe the Gemspec
Reference should be updated.

The install command has the --test or -t option.
Have a look at gem help install.

So, for example:
gem install examplegem --test

Interesting thing about running the tests this way ...
If the gem has no tests, it outputs "There are no unit tests to run".
If any tests fail, it prompts whether to keep the gem.
If no tests fail, there is no output and no indication that tests were run.

I don't really like that last part. I wish there was some output
indicating that the tests were actually run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top