How to test bundled applications using Aruba and Cucumber

Aruba Show archive.org snapshot is an extension to Cucumber that helps integration-testing command line tools.

When your tests involve a Rails test application, your tool's Bundler environment will shadow that of the test application. To fix this, just call unset_bundler_env_vars in a Cucumber Before block.

Previously suggested solution

Put the snippet below into your tool's features/support/env.rb -- now any command run through Aruba (e.g. via #run_simple) will have a clean Bundler environment.

module Customization
  
  # Improve the internal #run method provided by Aruba::Api to run commands
  # with a clean bundler environment and without spring.
  def run(cmd, timeout = nil)
    ENV['DISABLE_SPRING'] = '1'
    Bundler.with_clean_env { super }
  end

end
World(Customization)

We're also disabling Spring because it does not play nicely with Aruba (see Disabling Spring when debugging).

Dominik Schöler Almost 10 years ago