Sha256: c5cc5e48cc8788db338035621c63cd4f71028f7e9506da1d073e0e8c7cbd3961

Contents?: true

Size: 1.45 KB

Versions: 7338

Compression:

Stored size: 1.45 KB

Contents

RSpec::Support.require_rspec_core "bisect/utilities"

module RSpec
  module Core
    module Formatters
      # Contains common logic for formatters used by `--bisect` to communicate results
      # back to the bisect runner.
      #
      # Subclasses must define a `notify_results(all_example_ids, failed_example_ids)`
      # method.
      # @private
      class BaseBisectFormatter
        def self.inherited(formatter)
          Formatters.register formatter, :start_dump, :example_failed, :example_finished
        end

        def initialize(expected_failures)
          @all_example_ids = []
          @failed_example_ids = []
          @remaining_failures = expected_failures
        end

        def example_failed(notification)
          @failed_example_ids << notification.example.id
        end

        def example_finished(notification)
          @all_example_ids << notification.example.id
          return unless @remaining_failures.include?(notification.example.id)
          @remaining_failures.delete(notification.example.id)

          status = notification.example.execution_result.status
          return if status == :failed && !@remaining_failures.empty?
          RSpec.world.wants_to_quit = true
        end

        def start_dump(_notification)
          # `notify_results` is defined in the subclass
          notify_results(Bisect::ExampleSetDescriptor.new(
            @all_example_ids, @failed_example_ids))
        end
      end
    end
  end
end

Version data entries

7,338 entries across 7,273 versions & 88 rubygems

Version Path
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.28 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.28 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/rspec-core-3.10.0/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.27 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.27 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.26 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.26 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.25 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.25 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.24 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.24 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.23 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.23 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
rspec-core-3.10.0 lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.22 gems/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.22 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb
qiita_org-0.1.21 .bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb