Sha256: 2a63ca019f6e5679f9cecd1149559aca41bef0c74a2cd3fde94ff6ae6026b5fc

Contents?: true

Size: 810 Bytes

Versions: 4

Compression:

Stored size: 810 Bytes

Contents

require 'pork/report/dot'

module Pork
  class Description < Dot
    attr_accessor :last_executor

    def msg_pass
      msg = "\e[1Go"
      if respond_to?(:green, true)
        green(msg)
      else
        msg
      end
    end

    def msg_skip   ; "\e[1G#{super}"; end
    def msg_failed ; "\e[1G#{super}"; end
    def msg_errored; "\e[1G#{super}"; end

    def case_start context
      self.last_executor ||= Executor
      executor = context.class
      levels = executor.ancestors.drop(1).count{ |a| a <= Executor }

      if executor != Executor && last_executor != executor
        io.puts "#{'  ' * (levels - 1)}#{executor.desc}"
      end

      io.print "#{'  ' * levels}#{context.pork_description}"

      self.last_executor = executor
    end

    def case_end
      io.puts
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pork-1.4.4 lib/pork/report/description.rb
pork-1.4.3 lib/pork/report/description.rb
pork-1.4.2 lib/pork/report/description.rb
pork-1.4.1 lib/pork/report/description.rb