The following steps will setup ruby 1.8.7-p174 as well as the gems required for Capybara and Culerity support. It will also install Celerity using macports-managed JRuby. Note: sudo is not used.
Steps: $ rvm install 1.8.7-p174 $ rvm 1.8.7-p174 $ gem install rails cucumber capybara webrat rspec cucumber-rails email_spec database_cleaner rspec-rails factory_girl clearance formtastic sqlite3-ruby pg thin mongrel paperclip will_paginate ZenTest autotest-rails culerity $ rvm jruby-1.4.0 $ gem install celerity $ rvm 1.8.7-p174 $ cd your/rails/app
Add hooks.rb
to your features/support/ directory. Make sure to update the paths. Now, when using Capybara, @culerity
tagged scenarios will run correctly.
When you run rake features
, ruby-1.8.7-p174 will launch your test suite. When cucumber sees a @culerity
tagged scenario, it will shell out to jruby
. hooks.rb
is responsible for adjusting the various RubyGems environment variables so that jruby
is found.
Initially, I used the JRuby from MacPorts, but since I was using an rvm
managed Ruby, JRuby picked up on the RubyGems environment variables. This had the unpleasant side effect of causing JRuby to install gems into the gemdir managed by ruby-1.8.7-p174!
Did I mention this was a nasty hack?