# Test failing with gem only

**URL:** <https://www.ruby-forum.com/t/test-failing-with-gem-only/86417>\
**Category:** Ruby\
**Created:** [February 22, 2007, 3:27am UTC](https://www.ruby-forum.com/t/test-failing-with-gem-only/86417 "2007-02-22T03:27:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [February 22, 2007, 3:27am UTC](https://www.ruby-forum.com/t/test-failing-with-gem-only/86417/1 "2007-02-22T03:27:22Z")

</div>

Hi,

I’ve got an issue with some unit tests which pass fine under rake and  
when run manually, but fail when run at gem installation time.  
Unfortunately, gem doesn’t specify which tests fail - is there a way  
to change this behaviour? Or can anyone suggest any reasons for tests  
failing under gem -t but not under Rake?

I’ve pasted a session below showing what I mean. The rake test passes  
fine, then I build a fresh gem and attempt a gem -t install. This  
shows a few failures but I install anyway. Then I move to the gem  
directory and run the tests from there which again pass without  
failing. Knowing which tests are failing would be a start.

~/rubyforge/rsruby$ rake test  
/opt/ruby/lib/ruby/gems/bin/rake:17:Warning: require\_gem is  
obsolete. Use gem instead.  
(in /home/alexg/rubyforge/rsruby)  
/opt/ruby/bin/ruby -w -Ilib:ext:bin:test test/test\_all.rb  
Loaded suite test/test\_all  
Started  
…  
…  
Finished in 0.584575 seconds.

79 tests, 201 assertions, 0 failures, 0 errors  
~/rubyforge/rsruby$ rake package  
/opt/ruby/lib/ruby/gems/bin/rake:17:Warning: require\_gem is  
obsolete. Use gem instead.  
(in /home/alexg/rubyforge/rsruby)  
Successfully built RubyGem  
Name: rsruby  
Version: 0.4.3  
File: rsruby-0.4.3.gem  
mv rsruby-0.4.3.gem pkg/rsruby-0.4.3.gem  
~/rubyforge/rsruby$ gem install pkg/rsruby-0.4.3.gem -t – --with-R-  
dir=$R\_HOME  
Building native extensions. This could take a while…  
Successfully installed rsruby, version 0.4.3  
Installing ri documentation for rsruby-0.4.3…  
Installing RDoc documentation for rsruby-0.4.3…  
ERROR: 79 tests, 195 assertions, 5 failures, 1 errors  
…keep Gem? [Yn] y  
~/rubyforge/rsruby$ cd /opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3/  
/opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3$ ruby test/test\_all.rb  
Loaded suite test/test\_all  
Started  
…  
…  
Finished in 0.585885 seconds.

79 tests, 201 assertions, 0 failures, 0 errors  
/opt/ruby/lib/ruby/gems/gems/rsruby-0.4.3$

Alex G.

Bioinformatics Center  
Kyoto University

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [February 23, 2007, 12:55am UTC](https://www.ruby-forum.com/t/test-failing-with-gem-only/86417/2 "2007-02-23T00:55:11Z")

</div>

> failing. Knowing which tests are failing would be a start.

Try this: open site\_ruby/rubygems/validator.rb, find  
Gem::Validator#unit\_test and replace UI::SILENT with UI::NORMAL. It’s  
a hack, but should do the job.

---

<div class="post-metadata">

**Author:** ![oscar-alexander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/e36b37/32.png) [@oscar-alexander](https://www.ruby-forum.com/u/oscar-alexander)\
**Post date:** [February 23, 2007, 5:56am UTC](https://www.ruby-forum.com/t/test-failing-with-gem-only/86417/3 "2007-02-23T05:56:35Z")

</div>

On 23 Feb 2007, at 08:54, Jan S. wrote:

> > failing. Knowing which tests are failing would be a start.
> 
> Try this: open site\_ruby/rubygems/validator.rb, find  
> Gem::Validator#unit\_test and replace UI::SILENT with UI::NORMAL. It’s  
> a hack, but should do the job.

Thanks! You’re a superstar. I will be submitting a patch to rubygems  
to add this functionality on the command line. Unless anyone can  
think of a reason why you wouldn’t want to know which tests fail for  
a gem?

The answer to my original question was that the tests were getting  
run in a slightly different order to rake. A small bug in one of the  
setup routines meant that things weren’t quite getting reset to the  
way they should have been.

Alex G.

Bioinformatics Center  
Kyoto University
