Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit fc8ea09

Browse files
committed
add additional rdoc example for ordering
1 parent a99ff26 commit fc8ea09

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

lib/rspec/core/configuration.rb

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,11 @@ def self.delegate_to_ordering_manager(*methods)
13891389

13901390
# @macro delegate_to_ordering_manager
13911391
#
1392-
# Sets the default global order and, if order is `'rand:<seed>'`, also
1393-
# sets the seed.
1392+
# Sets the default global ordering strategy. By default this can be one
1393+
# of `:defined`, `:random`, but is customisable through the
1394+
# `register_ordering` API. See #register_ordering.
1395+
#
1396+
# If order is set to `'rand:<seed>'`, the seed will also be set.
13941397
delegate_to_ordering_manager :order=
13951398

13961399
# @macro delegate_to_ordering_manager
@@ -1412,13 +1415,32 @@ def self.delegate_to_ordering_manager(*methods)
14121415
# end
14131416
# end
14141417
#
1415-
# describe MyClass, :order => :reverse do
1418+
# RSpec.describe 'MyClass', :order => :reverse do
14161419
# # ...
14171420
# end
14181421
#
14191422
# @note Pass the symbol `:global` to set the ordering strategy that
14201423
# will be used to order the top-level example groups and any example
14211424
# groups that do not have declared `:order` metadata.
1425+
#
1426+
# @example
1427+
# RSpec.configure do |rspec|
1428+
# rspec.register_ordering :global do |examples|
1429+
# acceptance, other = examples.paritition do |example|
1430+
# example.metadata[:type] == :acceptance
1431+
# end
1432+
# other + acceptance
1433+
# end
1434+
# end
1435+
#
1436+
# RSpec.describe 'MyClass', :type => :acceptance
1437+
# # will run last
1438+
# end
1439+
#
1440+
# RSpec.describe 'MyClass', :type => :unit
1441+
# # will run first
1442+
# end
1443+
#
14221444
delegate_to_ordering_manager :register_ordering
14231445

14241446
# @private

0 commit comments

Comments
 (0)