Sha256: 281c2dc3902174ba619fa8792a88ba37940869393403264689f430a569fb7b29

Contents?: true

Size: 837 Bytes

Versions: 4

Compression:

Stored size: 837 Bytes

Contents

module RakeCheck
  module Checker
    ##
    # Check the Output of rspec and simplecov
    class Rspec < Base
      def run
        run_command({"COVERAGE" => "true"}, "rspec --color #{directory}")
      end

      def directory
        options[:directory] || 'spec'
      end

      def short_message
        if check_output.include?('Coverage report generated')
            coverage = /LOC \(([\d.]+)%\) covered/.match(check_output)[1].to_f
            coverage = case coverage
            when 0..60
              "#{coverage}%".red
            when 60..90
              "#{coverage}%".yellow
            when 90..100
              "#{coverage}%".green
            end
            "with #{coverage} Code Coverage"
        else
          ""
        end
      end

      def type
        "RSpec " + directory
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake_check-0.4.2 lib/rake_check/checker/rspec.rb
rake_check-0.4.1 lib/rake_check/checker/rspec.rb
rake_check-0.4.0 lib/rake_check/checker/rspec.rb
rake_check-0.3.6 lib/rake_check/checker/rspec.rb