lllllll
lllllll

Reputation: 4845

Output what Rspec "sees" to an HTML file

I have this RSpec test that used to pass. Now it doesn't and I can't see why.

In order to localize the problem, I was wondering whether there is a way to output to an HTML file what RSpec actually "sees". In other words, if I have:

before do
    #Create data here
    #
    #
    #sign user in here
    visit root_path
end

I would like to take the rendering of that root_path and write it to an HTML file, so I can inspect it manually via web browser.

thanks!

Upvotes: 0

Views: 156

Answers (1)

Jesse Wolgamott
Jesse Wolgamott

Reputation: 40277

You want to use 'save_and_open_page'. You may need to add 'launchy' to your gemfile. Once you do:

before do
    #Create data here
    #
    #
    #sign user in here
    visit root_path
    save_and_open_page
end

More: http://jeffkreeftmeijer.com/2010/ever-heard-of-capybaras-save_and_open_page-method/

Upvotes: 2

Related Questions