Sha256: 1df6dbf6bea04b6a96594ea8eae4c1f152dd5fd5b85aad866e26f00a93473170

Contents?: true

Size: 1 KB

Versions: 61

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true
module RSpec
  module Queue
    class BuildStatusRecorder
      ::RSpec::Core::Formatters.register self, :example_passed, :example_failed

      class << self
        attr_accessor :build
      end

      def initialize(*)
      end

      def example_passed(notification)
        example = notification.example
        build.record_success(example.id)
      end

      def example_failed(notification)
        example = notification.example
        build.record_error(example.id, [
          notification.fully_formatted(nil),
          colorized_rerun_command(example),
        ].join("\n"))
      end

      private

      def colorized_rerun_command(example, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
        colorizer.wrap("rspec #{example.location_rerun_argument}", RSpec.configuration.failure_color) + " " +
        colorizer.wrap("# #{example.full_description}",   RSpec.configuration.detail_color)
      end

      def build
        self.class.build
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
ci-queue-0.62.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.61.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.60.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.59.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.58.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.57.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.56.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.55.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.52.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.51.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.50.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.49.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.48.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.47.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.46.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.45.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.44.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.43.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.42.0 lib/rspec/queue/build_status_recorder.rb
ci-queue-0.41.0 lib/rspec/queue/build_status_recorder.rb