Sha256: 437168aa02dc91608c207d22e6eb55504161cc273f0e427d5f3c90a9a288bdeb

Contents?: true

Size: 662 Bytes

Versions: 16

Compression:

Stored size: 662 Bytes

Contents

module StartingBlocks
  class ResultParser

    def parse text
      output = load_the_output_from text
      output[:color] = color
      output
    end

    private

    def color
      return :red unless tests_exist?
      return :red if problems_exist?
      return :yellow if skips_exist?
      :green
    end

    def load_the_output_from text
      @output = StartingBlocks::ResultTextParser.new.parse text
    end

    def tests_exist?
      (@output[:tests] || 0) > 0
    end

    def problems_exist?
      ((@output[:errors] || 0) > 0) or ((@output[:failures] || 0) > 0)
    end

    def skips_exist?
      (@output[:skips] || 0) > 0
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
starting_blocks-1.2.1 lib/starting_blocks/result_parser.rb
starting_blocks-1.2.0 lib/starting_blocks/result_parser.rb
starting_blocks-1.1.3 lib/starting_blocks/result_parser.rb
starting_blocks-1.1.2 lib/starting_blocks/result_parser.rb
starting_blocks-1.1.1 lib/starting_blocks/result_parser.rb
starting_blocks-1.1.0 lib/starting_blocks/result_parser.rb
starting_blocks-1.0.0 lib/starting_blocks/result_parser.rb
starting_blocks-0.7.0 lib/starting_blocks/result_parser.rb
starting_blocks-0.6.1 lib/starting_blocks/result_parser.rb
starting_blocks-0.6.0 lib/starting_blocks/result_parser.rb
starting_blocks-0.5.2 lib/starting_blocks/result_parser.rb
starting_blocks-0.5.1 lib/starting_blocks/result_parser.rb
starting_blocks-0.5.0 lib/starting_blocks/result_parser.rb
starting_blocks-0.4.0 lib/starting_blocks/result_parser.rb
starting_blocks-0.3.1 lib/starting_blocks/result_parser.rb
starting_blocks-0.2.1 lib/starting_blocks/result_parser.rb