Class: RSpec::Core::Ordering::ConfigurationManager Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/ordering.rb |
Overview
Note:
This is not intended to be used externally. Use the APIs provided by ::RSpec::Core::Configuration
instead.
Manages ordering configuration.
Class Method Summary
- .new ⇒ ConfigurationManager constructor Internal use only
Instance Attribute Summary
- #order=(type) writeonly Internal use only
- #ordering_registry readonly Internal use only
- #seed rw Internal use only
- #seed=(seed) rw Internal use only
- #seed_used? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #force(hash) Internal use only
- #register_ordering(name, strategy = Custom.new(Proc.new { |l| yield l })) Internal use only
Instance Attribute Details
#order=(type) (writeonly)
[ GitHub ]# File 'rspec-core/lib/rspec/core/ordering.rb', line 164
def order=(type) order, seed = type.to_s.split(':') @seed = seed.to_i if seed ordering_name = if order.include?('rand') :random elsif order == 'defined' :defined elsif order == 'recently-modified' :recently_modified else order.to_sym end if ordering_name strategy = if ordering_registry.has_strategy?(ordering_name) ordering_registry.fetch(ordering_name) else Delayed.new(ordering_registry, ordering_name) end register_ordering(:global, strategy) end end
#ordering_registry (readonly)
[ GitHub ]# File 'rspec-core/lib/rspec/core/ordering.rb', line 145
attr_reader :seed, :ordering_registry
#seed (rw)
[ GitHub ]# File 'rspec-core/lib/rspec/core/ordering.rb', line 145
attr_reader :seed, :ordering_registry
#seed=(seed) (rw)
[ GitHub ]# File 'rspec-core/lib/rspec/core/ordering.rb', line 158
def seed=(seed) return if @seed_forced register_ordering(:global, ordering_registry.fetch(:random)) @seed = seed.to_i end
#seed_used? ⇒ Boolean
(readonly)
# File 'rspec-core/lib/rspec/core/ordering.rb', line 154
def seed_used? ordering_registry.used_random_seed? end
Instance Method Details
#force(hash)
[ GitHub ]#register_ordering(name, strategy = Custom.new(Proc.new { |l| yield l }))
[ GitHub ]# File 'rspec-core/lib/rspec/core/ordering.rb', line 201
def register_ordering(name, strategy=Custom.new(Proc.new { |l| yield l })) return if @order_forced && name == :global ordering_registry.register(name, strategy) end