Gentoo’s fake gems and RSpec

It was last month that I ranted about the lack of verbosity in Ruby ebuilds. While I haven’t had chance to work on the documentation building side of the fence just yet (simply because I really don’t know how documentation is usually built for Ruby packages) we have the RSpec 2-baed “recipe” implemented, which makes it dead easy to run tests with it from a fakegem ebuild.

Unfortunately, this does not apply to Test::Unit, either version 1 or 2, or MiniTest. For Test::Unit 2, I added a helper to ruby-ng.eclass that still makes it easier to deal with those tests, but it’s not possible to automate it as it requires quite a bit of work to be usable, as most of the software out there is not really tested with that framework but rather with standard Test::Unit or MiniTest. But you can’t have everything, can you?

On the other hand, today I’ve started porting packages using RSpec 1.x (dependency on dev-ruby/rspec:0) to RSpec 2 — for most, but not all, of them it’s straightforward. Features like shared example groups changed syntax, and require more hands-on porting, but for the most part I’ve seen them working just fine by calling rspec instead of spec and eventually removing the requirement of the old spec library. I’ll write a page in the Gentoo Wiki about porting to the new RSpec later on today.

What does this bring us? Well, first of all, during testing we no longer have to go through Rake, and eventual helper libraries such as Jeweler, Hoe, Echoe, Bones, etc. This saves us dependencies, which does not only mean that we have fewer packages to install, but also that we have fewer packages whose behaviour can modify the results of the tests. This is a huge difference.

Furthermore, both the RSpec and the Test::Unit 2 helpers respect TEST_VERBOSE and NOCOLOR which means that they don’t cause extra processing on my script on the Tinderbox (which has NOCOLOR set) and I have verbose output to see where Ruby is aborting when it is (it still seems to be random to me, but the memory is OK, memtested and everything).

So anyway, if you happen to rely on some gem and want to see it packaged in Gentoo… please consider making sure it uses RSpec 2 for testing!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s