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:

 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:

 source "https://rubygems.org"
 
 gem 'sinatra', '2.0.0.beta.2'
 
 group :development do
  gem 'rspec', '3.5.0'
  gem 'cucumber', '3.0.0.pre.1'
  gem 'capybara', '2.9.1'
  gem 'launchy', '2.4.3'
 end

Now run bundle to install the new gem.

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

Get The Cucumber Book, 2nd Edition 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.