Module: Prof::ExternalSpec::Helpers::Debug

Defined in:
lib/prof/external_spec/helpers/debug.rb

Instance Method Summary collapse

Instance Method Details

#recording_exceptionsObject



16
17
18
19
20
21
# File 'lib/prof/external_spec/helpers/debug.rb', line 16

def recording_exceptions
  yield
rescue Exception => ex
  @recorded_exception = ex
  raise
end

#save_exception_output(example) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/prof/external_spec/helpers/debug.rb', line 35

def save_exception_output(example)
  unless @recorded_exception
    return unless example.respond_to?(:exception)
    return unless example.respond_to?(:full_description)
    return unless respond_to?(:ops_manager)
    return unless example.exception
  end

  ops_manager.browser do |page|
    name = example.full_description.gsub(/\W/, '_')
    puts "Saving failure data for '#{name}'"
    page.save_page("#{name}.html")
    page.save_screenshot("#{name}.png")
  end
end

#save_exceptionsObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/prof/external_spec/helpers/debug.rb', line 23

def save_exceptions
  yield
rescue Exception => ex
  ops_manager.browser do |page|
    name = "failure"
    puts "Saving failure data for '#{name}'"
    page.save_page("#{name}.html")
    page.save_screenshot("#{name}.png")
  end
  raise
end