Building the User Interface

We can add a debugging hook to show us what’s going on in our failing scenario. Create a file features/support/debugging.rb:

support_code/14/features/support/debugging.rb
 
After ​do​ |scenario|
 
save_and_open_page ​if​ scenario.failed?
 
end

The method save_and_open_page is provided by Capybara, but it relies on the launchy gem that isn’t installed automatically. We’ll add it to our Gemfile:

support_code/14/Gemfile
 
source :rubygems
 
 
gem 'sinatra', '1.3.2'
 
 
group :development do
 
gem 'rspec', '2.11.0'
 
gem 'cucumber', '1.2.1'
 
gem 'capybara', '2.0.0.beta2'
 
gem 'launchy', '2.1.0'
 
end

Now run bundle to install the new gem.

What you should see if you run cucumber now is the web page that Cucumber can ...

Get The Cucumber Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.