Skip to content

Instantly share code, notes, and snippets.

@phillipoertel
Created September 26, 2011 23:22
Show Gist options
  • Save phillipoertel/1243730 to your computer and use it in GitHub Desktop.
Save phillipoertel/1243730 to your computer and use it in GitHub Desktop.
### Gemfile
group :test do
gem "rspec"
gem "capybara"
# ...
end
### spec_helper.rb
# ...
require 'capybara/rails'
require 'capybara/rspec'
# ...
### spec/requests/some_spec.rb
feature "Creating a flat" do
scenario "i get a validation error when price info is missing" do
visit(root_path)
click_on('Add flat')
click_on('Continue')
fill_in('Street', :with => 'Kazmairstraße 42')
fill_in('Neighbourhood', :with => 'Westend')
fill_in('Square meters', :with => '25')
click_on('Create')
page.should have_content('2 errors prohibited this flat from being saved')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment