Sha256: efb6046bc5f3d541b8444626457930a7fb12b334d186e5f8f825b01ee14fceac
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'oopsy' class Example attr_reader :description, :full_description, :run_time, :duration, :status, :exception, :file_path, :metadata, :spec, :screenshot def initialize(example) @description = example.description @full_description = example.full_description @execution_result = example.execution_result @run_time = (@execution_result.run_time).round(5) @duration = @execution_result.run_time.to_s(:rounded, precision: 5) @status = @execution_result.status.to_s @metadata = example.metadata @file_path = @metadata[:file_path] @exception = Oopsy.new(example.exception, @file_path) filename = File.basename(@metadata[:file_path]) line_number = @metadata[:line_number] @screenshot = "#{filename}-#{line_number}.png" @spec = nil end def has_exception? !@exception.klass.nil? end def has_spec? !@spec.nil? end def set_spec(spec) @spec = spec end def klass(prefix='label-') class_map = {passed: "#{prefix}success", failed: "#{prefix}danger", pending: "#{prefix}warning"} class_map[@status.to_sym] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec_yah_formatter-0.0.3 | lib/example.rb |
rspec_yah_formatter-0.0.2 | lib/example.rb |