Class: RSpec::Core::Ordering::Random
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb
Overview
Orders items randomly.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Random
constructor
A new instance of Random.
- #order(items) ⇒ Object
- #used? ⇒ Boolean
Constructor Details
#initialize(configuration) ⇒ Random
Returns a new instance of Random.
16 17 18 19 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 16 def initialize(configuration) @configuration = configuration @used = false end |
Instance Method Details
#order(items) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 25 def order(items) @used = true seed = @configuration.seed.to_s items.sort_by { |item| jenkins_hash_digest(seed + item.id) } end |
#used? ⇒ Boolean
21 22 23 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb', line 21 def used? @used end |