helper to investigate request test response HTML with nokogiri

Edit
equivalent Web Development
Public
RSpec
nokogiri






def pp_response(at: 'main')
puts "#{rand(100..999).to_s * 100}RESPONSE"
puts "Check RubyMine `Console` tab for the output" if ENV["EDITOR"] == "rubymine"
doc = Nokogiri::HTML5(body)
doc.at(at) # at <main> tag by default
puts doc.to_xhtml(indent: 2)
end


in request spec:

it do 
get '/foo'
pp_response
end

Payment successful

Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequatur amet labore.