Module: RSpec::Abq::Ordering

Defined in:
lib/rspec/abq/ordering.rb

Overview

This module is responsible for recording ordering for the manifest and reading the ordering from ‘init_meta` to set up the current processes settings

Constant Summary collapse

SUPPORTED_ORDERINGS =

notably: we don’t support custom orderings

if Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new("3.11.0")
  [:defined, :recently_modified, :random]
else
  [:defined, :random]
end
UnsupportedOrderingError =

Raised when we experience an ordering that doesn’t exist in SUPPORTED_ORDERINGS

Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.to_meta(seed, registry) ⇒ Object

takes a seed and a registry and produces a hash for the manifest



18
19
20
21
22
23
24
25
26
# File 'lib/rspec/abq/ordering.rb', line 18

def self.to_meta(seed, registry)
  global_ordering = registry.fetch(:global)
  ordering_name = SUPPORTED_ORDERINGS.find { |name| registry.fetch(name) == global_ordering }
  fail(UnsupportedOrderingError, "can't order based on unknown ordering: `#{global_ordering.class}`") unless ordering_name
  {
    ordering: ordering_name,
    seed: seed
  }
end