Thursday, March 19, 2015

Using save_and_open_page with Cucumber

Capybara has a nice utility method called save_and_open_page that will save the current page's HTML as a temp file and open it in your browser. This method is available by default in Ruby code (for example in an RSpec feature spec). As Cucumber is not direct Ruby, you can't directly say that. Fortunately, you can say

 Then show me the page  

and you'll get the same effect.