Sha256: f8f5b6ebe734f7579806162930fabe58b19a2b51cdc399689f433756767b80dc

Contents?: true

Size: 1.49 KB

Versions: 65

Compression:

Stored size: 1.49 KB

Contents

module Minitest
  module Reporters
    # Turn-like reporter that reads like a spec.
    #
    # Based upon TwP's turn (MIT License) and paydro's monkey-patch.
    #
    # @see https://github.com/TwP/turn turn
    # @see https://gist.github.com/356945 paydro's monkey-patch
    class SpecReporter < BaseReporter
      include ANSI::Code
      include RelativePosition

      def start
        super
        puts('Started with run options %s' % options[:args])
        puts
      end

      def report
        super
        puts('Finished in %.5fs' % total_time)
        print('%d tests, %d assertions, ' % [count, assertions])
        color = failures.zero? && errors.zero? ? :green : :red
        print(send(color) { '%d failures, %d errors, ' } % [failures, errors])
        print(yellow { '%d skips' } % skips)
        puts
      end

      def record(test)
        super
        record_print_status(test)
        record_print_failures_if_any(test)
      end

      protected

      def before_suite(suite)
        puts suite
      end

      def after_suite(_suite)
        puts
      end

      def record_print_status(test)
        test_name = test.name.gsub(/^test_: /, 'test:')
        print pad_test(test_name)
        print_colored_status(test)
        print(" (%.2fs)" % test.time) unless test.time.nil?
        puts
      end

      def record_print_failures_if_any(test)
        if !test.skipped? && test.failure
          print_info(test.failure, test.error?)
          puts
        end
      end
    end
  end
end

Version data entries

65 entries across 30 versions & 4 rubygems

Version Path
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/minitest-reporters-1.5.0/lib/minitest/reporters/spec_reporter.rb
minitest-reporters-1.5.0 lib/minitest/reporters/spec_reporter.rb
minitest-reporters-1.4.3 lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/paynow_sdk-1.0.9/vendor/bundle/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.1.0 vendor/bundle/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.9 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.9 vendor/bundle/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.8 vendor/bundle/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.8 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.7 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.6 vendor/cache/ruby/2.7.0/gems/paynow_sdk-1.0.0/vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb
paynow_sdk-1.0.5 vendor/cache/ruby/2.7.0/gems/minitest-reporters-1.4.2/lib/minitest/reporters/spec_reporter.rb