Blog ยป Steak Capybara on Rails 2.3
Posted on 22 Nov 2010 17:31
Using Capybara with Steak is a very easy way acceptance testing on Rails. However, to run this nice test framework for your Rais 2.3.x applications you need to install rspec, steak and capybara as below. Rails 2.3.x uses rspec 1.3.x.
Using Hobo Edge On Rails 3 describes installing gems for both Rails 2 and Rails 3. But if you won't use RVM:
sudo gem install rspec --version 1.3.1 sudo gem install rspec-rails --version 1.3.3 sudo gem install steak --version 0.3.8 sudo gem install capybara
Then, in your project root initialize rspec:
script/generate rspec #Initialize rspec
Now you can apply Using Capybara with Steak:
script/generate steak --capybara #Initialize steak script/generate acceptance_spec your_feature #Create an acceptance test stub
Finally, to run all of your acceptance tests:
rake spec:acceptance
My Test Environment
Now I am using Bundler. $project/Gemfile contains
group :test do gem "factory_girl" gem "shoulda" gem "mocha" gem "rspec", "= 1.3.1", :require => nil gem "rspec-rails", "= 1.3.3", :require => nil gem "steak" gem "capybara" end gem 'ruby-debug', :groups => [:test, :development]
Before Bundler,
environments/test.rb
- used to contain the correct config.gem entries
config.gem 'factory_girl' config.gem 'shoulda' config.gem 'webrat' config.gem 'rspec', :lib=>false, :version => '1.3.1' config.gem 'rspec-rails', :lib=>false, :version => '1.3.3' config.gem 'steak', :version => '0.3.8' config.gem 'capybara'
This was specific to Steak/Capybara. Environments/Testing details the rest of the test config files and conventions I am using.
Using Capybara you'll also need to set using transactional fixtures to false in spec_helper.rb. Then you need to delete all records after the tests.
If you like this page, please spread the word:
You can contact me if you have questions or corrections.


