I've just installed the aruba gem which is an extension to cucumber. It allows you to test command line applications - like generators in Rails (but, as the documentation points out, you could use it for any cmd app).
I have been following this pivotal labs article about using it, but for some reason it doesn't get past the first step: the first step is green ( the creation of the app ), but the following step tries to cd test_app
and can't find it and fails.
Given I run "rails new test_app" # features/step_definitions/aruba_steps.rb:95
And I cd to "test_app" # features/step_definitions/aruba_steps.rb:91
tmp/aruba/test_app is not a directory. (RuntimeError)
./features/step_definitions/aruba_steps.rb:92:in `/^I cd to "([^"]*)"$/'
features/generators.feature:9:in `And I cd to "test_app"'
It would appear that the application folder isn't actually being created, although looking in the base dir I can see the tmp/aruba/ folding is . After poking around the source for a while I can't come up with anything as to why. Has anybody else had any experience with this gem and found the same thing?
Are there any nice BDD alternatives to testing generators or rake tasks etc?
Further to Ryans answer:
Once I added the following to the features/support/env.rb
(working from the base rails directory):
Before do
@dirs = [File.expand_path(File.dirname(__FILE__) + '/../../../aruba_test_dir')]
end
So that cucumber is building the app outside of the current rails app, this fixes the issue.