Otaqui.com Blog

Cucumber with Webrat and Mechanize on CentOS 5

Thanks to Chris for this one.

The trick is to use JRuby and its gems, and also to install libxml2-devel

$ cd ~
$ wget http://jruby.kenai.com/downloads/1.4.0/jruby-bin-1.4.0.tar.gz
$ tar -C /usr/local/ -xzvf jruby-bin-1.4.0.tar.gz

You should now have Jruby. Add it’s bin directory to your path, presumably in your ~/.bash_profile file:
$ export PATH=$PATH:/usr/local/jruby-1.4.0/bin
$ jruby -v

Now install some mechanize requirements:
$ sudo yum install libxml2-devel libxslt-devel

If you don’t already have the “normal” ruby installed, you can get to the jruby “gem” command by just typing “gem”. If you do have ruby, or want to be absolutely sure, type the commands like this:
$ jruby -S gem install cucumber mechanize webrat

You’re good to go! You should now be able to run your features with:

$ cucumber features/