O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required