1. Add the following to your ‘Gemfile’ which is located in the root of your application.
———-
# Testing Gems
group :test do
gem ‘cucumber-rails’, ‘0.3.2’ # BDD testing framework based on Features
gem ‘capybara’, ‘0.4.1.1’ # Integrations testing for Rack Applications (Rails)
gem ‘rspec-rails’, ‘2.4.1’ # BDD testing framework
gem ‘webrat’, ‘0.7.3’ # Acceptance testing framework
end
———-
2. From a command prompt which has the current path set to the root of your Rails 3 application run the following command. This will install both the cucumber gem as well as the cucumber-rails gem. It will also install RSpec with all of its dependencies as well.
———-
bundle install
———-
3. Now you need to install rspec into your application. By running the rspec generator it will add new folders and files to your basic rails 3 application. In the command prompt where you just executed the previous command you are now going to execute the following command.
———-
rails g rspec:install
———-
4. Setup rspec to create tests automatically by adding a generator to your application.rb file
———-
config.generators do |g|
g.test_framework :rspec
end
———-
5. Now you need to install cucumber into your application. By running the cucumber generator it will ad new folders and files to your basic rails 3 application. In the command prompt where you just executed the previous command you are now going to execute the following command. (please note the – -rspec and – -capybara are proceeded by two dashes in a row not single dashes.)
———-
rails g cucumber:install –rspec –capybara
———-
6. Now you need to install cucumber into your application. by running the cucumber generator which will add new folders and files to your basic rails 3 application. In the command prompt where you just executed the previous command you are going to execute the following command.
——–
rails g cucumber:install
——–
7. For color coded output on windows within the command prompt you will need to install ANSICON by following the steps below.
- Download http://adoxa.110mb.com/ansicon/ansi132.zip and unzip it
- Use a cmd prompt and navigate to where you unzipped it.
- CD into the x64 directory (unless you have a 32bit machine, then use the x86 one)
- Type “ansicon.exe –i” (without quotes)
- Open a new cmd prompt
Thanks for the information – but do you have an alternative to step #1 since the down-stream dependencies include the json gem which is C-compiled instead of the json_pure gem which anyone using Rails can use?
Thanks!
LikeLike
I strongly recommend that you install DevKit, that way C-compliled gems will work, it's just easier than trying to find versions that could work with json_pure.
LikeLike