TDD setup and execution in Rails
1. On creating project tells Rails not to generate a test directory associated with the default Test::Unit framework. we will be using an alternate testing framework called RSpec to write a thorough test suite.
rails new [project name] --skip-test-unit
2. Add Gems:
Add following gem in development mode so that we have access to RSpec-specific generators, and it includes it in test mode in order to run the tests. We don’t have to install RSpec itself because it is a dependency of rspec-rails and will thus be installed automatically:
group :development, :test do . . gem 'rspec-rails', '2.11.0' . . end
Include the Capybara gem in test mode, which allows us to simulate a user’s interaction with the application using a natural English-like syntax.
group :test do gem 'capybara', '1.1.2' end
To install and include the new gems, we run bundle update and bundle install
bundle update bundle install…
View original post 166 more words