Sha256: f52c6f3bf7fb9084b78f9e25330984578fe7ce67dd2be9667d37ceb549413a0f

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

require 'turnip_formatter/printer'
require 'turnip_formatter/printer/step_extra_args'

module TurnipFormatter
  module Printer
    class RuntimeError
      class << self
        include TurnipFormatter::Printer
        include RSpec::Core::BacktraceFormatter

        def print_out(example, exception)
          exception.set_backtrace(format_backtrace(exception.backtrace))
          render_template(:runtime_exception, {
              example: example,
              runtime_exception: runtime_exception(exception),
              example_exception: example_exception(example),
            }
          )
        end

        private

        def runtime_exception(exception)
          render_template(:exception, { title: 'Runtime', exception: exception })
        end

        def example_exception(example)
          unless example.exception
            ''
          else
            render_template(:exception, {
                title: 'Example',
                exception: example.exception
              }
            )
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
turnip_formatter-0.3.0 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.11 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.10 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.9 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.8 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.7 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.6 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.5 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.4 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.3 lib/turnip_formatter/printer/runtime_error.rb
turnip_formatter-0.2.2 lib/turnip_formatter/printer/runtime_error.rb