Sha256: 77f5d5cea095acd2b00cbc37806a967c39c73fd265eb171b6d0e3975bde48fbd

Contents?: true

Size: 967 Bytes

Versions: 5

Compression:

Stored size: 967 Bytes

Contents

# -*- coding: utf-8 -*-

module TurnipFormatter
  class Step
    attr_reader :name, :docs, :example

    class << self
      def templates
        @templates ||= {}
      end

      def add_template(status, style, klass = nil, &block)
        templates[status] ||= {}
        templates[status][style] = { klass: klass, block: block }
      end

      def remove_template(status, style)
        templates[status].delete(style)
        templates.delete(status.to_sym) if templates[status.to_sym].empty?
      end

      def status
        ''
      end
    end

    #
    # @param  [RSpec::Core::Example]  example
    # @param  [Hash]  description
    #
    def initialize(example, description)
      @example = example
      @name = description[:keyword] + description[:name]
      @docs = { extra_args: { klass: nil, value: description[:extra_args] } }
    end

    def attention?
      !status.empty?
    end

    def status
      self.class.status
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
turnip_formatter-0.1.2 lib/turnip_formatter/step.rb
turnip_formatter-0.1.1 lib/turnip_formatter/step.rb
turnip_formatter-0.1.0 lib/turnip_formatter/step.rb
turnip_formatter-0.0.6 lib/turnip_formatter/step.rb
turnip_formatter-0.0.5 lib/turnip_formatter/step.rb