rspec basics


When you create a new site, skip generating unit test, as you want to use rspec instead.

[sourcecode language="bash"]
$ rails new sample_app --skip-test-unit
[/sourcecode]

Add rspec to your gemfile

[sourcecode language="rails"]
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails', '2.9.0'
end

group :test do
gem 'capybara', '1.1.2'
end
[/sourcecode]

copybara gem allows you to interact with the app with a natual English-like syntaxt.

Then run bundle install to install those gems.

[sourcecode language="bash"]
$ bundle install --without production
[/sourcecode]

Configure your rails app to use rspec in place of test::unit.

[sourcecode language="bash"]
$ rails generate rspec:install
[/sourcecode]