nayati 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +79 -0
  4. data/Rakefile +32 -0
  5. data/app/models/nayati/application_record.rb +5 -0
  6. data/app/models/nayati/master_operation.rb +46 -0
  7. data/app/models/nayati/master_workflow.rb +67 -0
  8. data/app/models/nayati/name_based_constantable.rb +30 -0
  9. data/app/models/nayati/operation.rb +29 -0
  10. data/app/models/nayati/operation_configuration.rb +73 -0
  11. data/app/models/nayati/operation_implementer_base.rb +21 -0
  12. data/app/models/nayati/workflow.rb +170 -0
  13. data/config/operations.yml +3 -0
  14. data/db/migrate/20200127144219_create_workflow.rb +16 -0
  15. data/db/migrate/20200127144220_create_operation.rb +19 -0
  16. data/lib/generators/nayati/install/install_generator.rb +30 -0
  17. data/lib/generators/nayati/install/templates/create_operation.rb +19 -0
  18. data/lib/generators/nayati/install/templates/create_workflow.rb +16 -0
  19. data/lib/generators/nayati/install/templates/operations.yml +3 -0
  20. data/lib/generators/nayati/operation/operation_generator.rb +46 -0
  21. data/lib/generators/nayati/operation/templates/operation_template.txt +20 -0
  22. data/lib/generators/nayati/workflow/templates/nayati_service_template.txt +20 -0
  23. data/lib/generators/nayati/workflow/workflow_generator.rb +39 -0
  24. data/lib/nayati.rb +5 -0
  25. data/lib/nayati/engine.rb +12 -0
  26. data/lib/nayati/version.rb +3 -0
  27. data/lib/nayati/workflow_results/base.rb +18 -0
  28. data/lib/nayati/workflow_runner.rb +34 -0
  29. data/spec/dummy/Rakefile +6 -0
  30. data/spec/dummy/app/models/application_record.rb +3 -0
  31. data/spec/dummy/bin/bundle +3 -0
  32. data/spec/dummy/bin/rails +4 -0
  33. data/spec/dummy/bin/rake +4 -0
  34. data/spec/dummy/bin/setup +36 -0
  35. data/spec/dummy/bin/update +31 -0
  36. data/spec/dummy/bin/yarn +11 -0
  37. data/spec/dummy/config.ru +5 -0
  38. data/spec/dummy/config/application.rb +19 -0
  39. data/spec/dummy/config/boot.rb +5 -0
  40. data/spec/dummy/config/cable.yml +10 -0
  41. data/spec/dummy/config/database.yml +24 -0
  42. data/spec/dummy/config/environment.rb +5 -0
  43. data/spec/dummy/config/environments/development.rb +61 -0
  44. data/spec/dummy/config/environments/production.rb +94 -0
  45. data/spec/dummy/config/environments/test.rb +46 -0
  46. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  47. data/spec/dummy/config/initializers/assets.rb +14 -0
  48. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  50. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  51. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/spec/dummy/config/initializers/inflections.rb +16 -0
  53. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  54. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/spec/dummy/config/locales/en.yml +33 -0
  56. data/spec/dummy/config/operations.yml +3 -0
  57. data/spec/dummy/config/puma.rb +34 -0
  58. data/spec/dummy/config/spring.rb +6 -0
  59. data/spec/dummy/config/storage.yml +34 -0
  60. data/spec/dummy/db/migrate/20200202111127_create_workflow.rb +16 -0
  61. data/spec/dummy/db/migrate/20200202111128_create_operation.rb +19 -0
  62. data/spec/dummy/db/schema.rb +36 -0
  63. data/spec/dummy/log/development.log +56 -0
  64. data/spec/dummy/package.json +5 -0
  65. data/spec/dummy/public/404.html +67 -0
  66. data/spec/dummy/public/422.html +67 -0
  67. data/spec/dummy/public/500.html +66 -0
  68. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  69. data/spec/dummy/public/apple-touch-icon.png +0 -0
  70. data/spec/dummy/public/favicon.ico +0 -0
  71. data/spec/factories/operations_factory.rb +6 -0
  72. data/spec/factories/workflow_factory.rb +7 -0
  73. data/spec/lib/decider/workflow_runner_spec.rb +59 -0
  74. data/spec/lib/decider_spec.rb +4 -0
  75. data/spec/models/decider/master_operation_spec.rb +26 -0
  76. data/spec/models/decider/master_workflow_spec.rb +28 -0
  77. data/spec/models/decider/operation_spec.rb +48 -0
  78. data/spec/models/decider/workflow_spec.rb +159 -0
  79. data/spec/rails_helper.rb +57 -0
  80. data/spec/spec_helper.rb +120 -0
  81. metadata +259 -0
@@ -0,0 +1,4 @@
1
+ RSpec.describe Nayati do
2
+ it 'Decides things' do
3
+ end
4
+ end
@@ -0,0 +1,26 @@
1
+ module Nayati
2
+ RSpec.describe MasterOperation do
3
+
4
+ describe '#exists?' do
5
+ let(:master_workflow_name) { 'abcd_pqrs' }
6
+ let(:master_workflow) { MasterWorkflow.new(master_workflow_name) }
7
+ let(:operation_name) { 'operation_of_abcd_pqrs' }
8
+ context 'When operation is already present' do
9
+
10
+ subject { MasterOperation.new(master_workflow, operation_name).exists? }
11
+ it 'Returns true' do
12
+ allow(master_workflow).to receive(:operation_names) { [operation_name, 'some_other_operation_name'] }
13
+ expect(subject).to be_truthy
14
+ end
15
+ end
16
+
17
+ context 'When operation does not exist' do
18
+ subject { MasterOperation.new(master_workflow, operation_name).exists? }
19
+ it 'Returns false' do
20
+ allow(master_workflow).to receive(:operation_names) { ['some_other_operation_name'] }
21
+ expect(subject).to be_falsey
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ module Nayati
2
+ RSpec.describe MasterWorkflow do
3
+
4
+ describe '#exists?' do
5
+ let(:workflow_name) { 'abcd_pqrs' }
6
+ let(:master_workflow) { MasterWorkflow.new(workflow_name) }
7
+ context 'Operation configuration#workflow_names does not have workflow name' do
8
+
9
+ subject { master_workflow.exists? }
10
+ it 'Returns false' do
11
+ allow(Nayati::OperationConfiguration).to receive(:workflow_names) { [] }
12
+ expect(subject).to be_falsey
13
+ end
14
+ end
15
+
16
+ context 'Operation configuration#workflow_names does have workflow name' do
17
+ let(:workflow_name) { 'abcd_pqrs' }
18
+ let(:master_workflow) { MasterWorkflow.new(workflow_name) }
19
+
20
+ subject { master_workflow.exists? }
21
+ it 'Returns false' do
22
+ allow(Nayati::OperationConfiguration).to receive(:workflow_names) { [workflow_name.to_sym, :something_else] }
23
+ expect(subject).to be_truthy
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,48 @@
1
+ module Nayati
2
+ RSpec.describe Operation do
3
+ describe '#operation_implementer_klass_name' do
4
+ let(:operation) { create(:nayati_operation)}
5
+ subject { operation.operation_implementer_klass_name }
6
+
7
+ it 'Returns workflow namespaced klass name' do
8
+ expect(subject).to eq('DoingSomethingNayatiWorkflow::SomeOperationNayatiOperation')
9
+ end
10
+ end
11
+
12
+ describe '#build_implementer' do
13
+ let(:operation) { create(:nayati_operation)}
14
+ let(:context) { {} }
15
+ let(:workflow_result_object) { double }
16
+ let(:implementer_klass) { double }
17
+ let(:implementer_klass_name) { double }
18
+ let(:implementer_instance) { double }
19
+
20
+ subject { operation.build_implementer(context, workflow_result_object) }
21
+ it 'Returns implementer class' do
22
+ allow(operation).to receive(:operation_implementer_klass_name) { implementer_klass_name }
23
+ allow(implementer_klass_name).to receive(:constantize) { implementer_klass }
24
+ allow(implementer_klass).to receive(:new).with(context, workflow_result_object) { implementer_instance }
25
+ expect(subject).to eq(implementer_instance)
26
+ # allow()
27
+ end
28
+ end
29
+
30
+ describe 'associations' do
31
+ it { Operation.reflect_on_association(:after_success_operation).macro.should eq(:belongs_to) }
32
+ it { Operation.reflect_on_association(:after_failure_operation).macro.should eq(:belongs_to) }
33
+ it { Operation.reflect_on_association(:workflow).macro.should eq(:belongs_to) }
34
+ end
35
+
36
+ describe '#validatoin' do
37
+ let(:workflow) { create(:nayati_workflow) }
38
+ let(:operation) { Nayati::Operation.new }
39
+ subject { operation.valid? }
40
+
41
+ it 'Returns false with proper error message' do
42
+ expect(subject).to be_falsey
43
+ expect(operation.errors.messages[:workflow]).to include('must exist')
44
+ expect(operation.errors.messages[:name]).to include("can't be blank")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,159 @@
1
+ require 'pry'
2
+ module Nayati
3
+ RSpec.describe Workflow, type: :model do
4
+ describe '#name_space' do
5
+ let(:workflow) { create(:nayati_workflow)}
6
+
7
+ subject { workflow.name_space }
8
+ it 'Returens proper name space' do
9
+ expect(subject).to eq('doing_something')
10
+ end
11
+ end
12
+
13
+ describe '#klass_name' do
14
+ let(:workflow) { create(:nayati_workflow)}
15
+
16
+ subject { workflow.klass_name }
17
+ it 'Returns proper name space' do
18
+ expect(subject).to eq('DoingSomethingWorkflow')
19
+ end
20
+ end
21
+
22
+ describe '#klass' do
23
+ let(:workflow) { create(:nayati_workflow)}
24
+
25
+ subject { workflow.klass }
26
+
27
+ context 'Workflow running context is not set' do
28
+ it 'Raises an error' do
29
+ expect{subject}.to raise_error(Nayati::Workflow::ContextNotSetError)
30
+ end
31
+ end
32
+
33
+ let(:implementer_klass_name) { "DoingSomething" }
34
+ let(:implementer_klass) { double }
35
+ let(:implementer_klass_instance) { double }
36
+ let(:workflow_running_context) { double }
37
+ it 'Returns the implementer class instance of the workflow' do
38
+ workflow.context = workflow_running_context
39
+ allow(workflow).to receive(:klass_name) { implementer_klass_name }
40
+ expect(implementer_klass_name).to receive(:constantize) { implementer_klass }
41
+ expect(implementer_klass).to receive(:new).with(workflow_running_context) {implementer_klass_instance}
42
+ expect(subject).to eq(implementer_klass_instance)
43
+ end
44
+ end
45
+
46
+ describe '#specific_result_obj_klass_constant_name' do
47
+ let(:workflow) { create(:nayati_workflow) }
48
+ subject { workflow.specific_result_obj_klass_constant_name }
49
+
50
+ it 'Returns specific result object class name' do
51
+ expect(subject).to eq("Nayati::WorkflowResults::DoingSomethingWorkflow")
52
+ end
53
+ end
54
+
55
+ describe '#result_obj_klass' do
56
+ context 'Specific result class is present' do
57
+ let(:workflow) { create(:nayati_workflow) }
58
+ let(:result_klass) { double }
59
+ let(:result_klass_instance) { double }
60
+ subject { workflow.result_obj }
61
+ it 'Returns that class' do
62
+ allow(Module).to receive(:const_get).with(workflow.specific_result_obj_klass_constant_name) { result_klass }
63
+ allow(result_klass).to receive(:new) { result_klass_instance }
64
+ expect(subject).to eq(result_klass_instance)
65
+ end
66
+ end
67
+
68
+ context 'Specific result class is absent' do
69
+ let(:workflow) { create(:nayati_workflow) }
70
+ subject { workflow.result_obj }
71
+ it 'Returns that class' do
72
+ expect(subject).to be_an_instance_of(Nayati::WorkflowResults::Base)
73
+ end
74
+ end
75
+ end
76
+
77
+ describe '#specific_result_klass_present?' do
78
+ let(:workflow) { create(:nayati_workflow)}
79
+ subject { workflow.specific_result_klass_present? }
80
+
81
+ it 'Returns false if specific_result_klass is present?' do
82
+
83
+ end
84
+ end
85
+
86
+ describe '#result_obj' do
87
+ let(:workflow) { create(:nayati_workflow) }
88
+ context 'Workflow specific result object is present' do
89
+ it 'Returns that specific result object' do
90
+ # allow(Object).to receive(:const_defined?).with("Result"workflow.name)
91
+ end
92
+ end
93
+
94
+ context 'Workflow specific result object is not present' do
95
+ it 'Returns default result object' do
96
+ end
97
+ end
98
+ end
99
+
100
+ describe 'Validations' do
101
+ describe 'Creation' do
102
+ let(:workflow_name) { 'Some Name' }
103
+ let(:initial_operation_name) { 'First operation of the workflow' }
104
+
105
+ context 'Initial operation name is not passed' do
106
+ let(:workflow_creation_params) { { name: workflow_name } }
107
+ let(:workflow_obj) { Nayati::Workflow.new(workflow_creation_params) }
108
+ subject { workflow_obj.valid? }
109
+ it 'Adds proper error to workflow object' do
110
+ subject
111
+ expect(workflow_obj.errors[:initial_operation_name]).to include("Please set initial_operation_name")
112
+ end
113
+ end
114
+
115
+ context 'initial_operation_name is passed' do
116
+ let(:workflow_creation_params) { { name: workflow_name, initial_operation_name: initial_operation_name } }
117
+ let(:workflow_obj) { Nayati::Workflow.new(workflow_creation_params) }
118
+
119
+ subject { workflow_obj.valid? }
120
+ it 'Returns true' do
121
+ expect(subject).to be_truthy
122
+ end
123
+ end
124
+ end
125
+ end
126
+
127
+ describe 'Workflow object persistance' do
128
+ let(:workflow_name) { 'Some Name' }
129
+ let(:initial_operation_name) { 'First operation of the workflow' }
130
+
131
+ context 'Workflow object is valid' do
132
+ describe 'Creation' do
133
+ let(:workflow_creation_params) { { name: workflow_name, initial_operation_name: initial_operation_name } }
134
+ let(:workflow_obj) { Nayati::Workflow.new(workflow_creation_params) }
135
+
136
+ subject { workflow_obj.save }
137
+ it 'Persists workfow record' do
138
+ expect{subject}.to change{Nayati::Workflow.where(name: workflow_name).count}.by(1)
139
+ end
140
+
141
+ subject { workflow_obj.save }
142
+ it 'Creates initial operation record' do
143
+ expect{subject}.to change{Nayati::Operation.count}.by(1)
144
+ expect(workflow_obj.reload.initial_operation.name).to eq('first_operation_of_the_workflow')
145
+ end
146
+ end
147
+ end
148
+ end
149
+
150
+ describe '#self.assign_from_creation_params' do
151
+ let(:params) { { name: 'some_workflow_name', initial_operation_name: 'some_operation_name' } }
152
+ subject { Workflow.assign_from_creation_params(params) }
153
+ it 'Assigns from params' do
154
+ expect(subject.initial_operation_name).to eq('some_operation_name')
155
+ expect(subject.name).to eq('some_workflow_name')
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,57 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require File.expand_path('../../config/environment', __FILE__)
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ require 'rspec/rails'
8
+ # Add additional requires below this line. Rails is not loaded until this point!
9
+
10
+ # Requires supporting ruby files with custom matchers and macros, etc, in
11
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12
+ # run as spec files by default. This means that files in spec/support that end
13
+ # in _spec.rb will both be required and run as specs, causing the specs to be
14
+ # run twice. It is recommended that you do not name files matching this glob to
15
+ # end with _spec.rb. You can configure this pattern with the --pattern
16
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17
+ #
18
+ # The following line is provided for convenience purposes. It has the downside
19
+ # of increasing the boot-up time by auto-requiring all files in the support
20
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
+ # require only the support files necessary.
22
+ #
23
+ # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24
+
25
+ # Checks for pending migrations and applies them before tests are run.
26
+ # If you are not using ActiveRecord, you can remove this line.
27
+ ActiveRecord::Migration.maintain_test_schema!
28
+
29
+ RSpec.configure do |config|
30
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
32
+
33
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
34
+ # examples within a transaction, remove the following line or assign false
35
+ # instead of true.
36
+ config.use_transactional_fixtures = true
37
+
38
+ # RSpec Rails can automatically mix in different behaviours to your tests
39
+ # based on their file location, for example enabling you to call `get` and
40
+ # `post` in specs under `spec/controllers`.
41
+ #
42
+ # You can disable this behaviour by removing the line below, and instead
43
+ # explicitly tag your specs with their type, e.g.:
44
+ #
45
+ # RSpec.describe UsersController, :type => :controller do
46
+ # # ...
47
+ # end
48
+ #
49
+ # The different available types are documented in the features, such as in
50
+ # https://relishapp.com/rspec/rspec-rails/docs
51
+ config.infer_spec_type_from_file_location!
52
+
53
+ # Filter lines from Rails gems in backtraces.
54
+ config.filter_rails_from_backtrace!
55
+ # arbitrary gems may also be filtered via:
56
+ # config.filter_gems_from_backtrace("gem name")
57
+ end
@@ -0,0 +1,120 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+
17
+ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
18
+
19
+ ENV["RAILS_ENV"] ||= 'test'
20
+ require File.expand_path("../dummy/config/environment", __FILE__)
21
+ require 'rspec/rails'
22
+ require 'rspec/autorun'
23
+ require 'factory_girl'
24
+ # require '../factories/workflow_factory'
25
+
26
+
27
+ Rails.backtrace_cleaner.remove_silencers!
28
+
29
+ # Load support files
30
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
31
+ # Load factories
32
+ Dir["#{File.dirname(__FILE__)}/factories/**/*.rb"].each { |f| require f }
33
+
34
+ RSpec.configure do |config|
35
+ config.include Nayati::Engine.routes.url_helpers
36
+ config.use_transactional_fixtures = true
37
+ config.infer_base_class_for_anonymous_controllers = false
38
+ config.include FactoryGirl::Syntax::Methods
39
+ config.order = "random"
40
+
41
+ # rspec-expectations config goes here. You can use an alternate
42
+ # assertion/expectation library such as wrong or the stdlib/minitest
43
+ # assertions if you prefer.
44
+ config.expect_with :rspec do |expectations|
45
+ # This option will default to `true` in RSpec 4. It makes the `description`
46
+ # and `failure_message` of custom matchers include text for helper methods
47
+ # defined using `chain`, e.g.:
48
+ # be_bigger_than(2).and_smaller_than(4).description
49
+ # # => "be bigger than 2 and smaller than 4"
50
+ # ...rather than:
51
+ # # => "be bigger than 2"
52
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
53
+ end
54
+
55
+ # rspec-mocks config goes here. You can use an alternate test double
56
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
57
+ config.mock_with :rspec do |mocks|
58
+ # Prevents you from mocking or stubbing a method that does not exist on
59
+ # a real object. This is generally recommended, and will default to
60
+ # `true` in RSpec 4.
61
+ mocks.verify_partial_doubles = true
62
+ end
63
+
64
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
65
+ # have no way to turn it off -- the option exists only for backwards
66
+ # compatibility in RSpec 3). It causes shared context metadata to be
67
+ # inherited by the metadata hash of host groups and examples, rather than
68
+ # triggering implicit auto-inclusion in groups with matching metadata.
69
+ config.shared_context_metadata_behavior = :apply_to_host_groups
70
+
71
+ # The settings below are suggested to provide a good initial experience
72
+ # with RSpec, but feel free to customize to your heart's content.
73
+ =begin
74
+ # This allows you to limit a spec run to individual examples or groups
75
+ # you care about by tagging them with `:focus` metadata. When nothing
76
+ # is tagged with `:focus`, all examples get run. RSpec also provides
77
+ # aliases for `it`, `describe`, and `context` that include `:focus`
78
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
79
+ config.filter_run_when_matching :focus
80
+
81
+ # Allows RSpec to persist some state between runs in order to support
82
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
83
+ # you configure your source control system to ignore this file.
84
+ config.example_status_persistence_file_path = "spec/examples.txt"
85
+
86
+ # Limits the available syntax to the non-monkey patched syntax that is
87
+ # recommended. For more details, see:
88
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
89
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
90
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
91
+ config.disable_monkey_patching!
92
+
93
+ # Many RSpec users commonly either run the entire suite or an individual
94
+ # file, and it's useful to allow more verbose output when running an
95
+ # individual spec file.
96
+ if config.files_to_run.one?
97
+ # Use the documentation formatter for detailed output,
98
+ # unless a formatter has already been configured
99
+ # (e.g. via a command-line flag).
100
+ config.default_formatter = "doc"
101
+ end
102
+
103
+ # Print the 10 slowest examples and example groups at the
104
+ # end of the spec run, to help surface which specs are running
105
+ # particularly slow.
106
+ config.profile_examples = 10
107
+
108
+ # Run specs in random order to surface order dependencies. If you find an
109
+ # order dependency and want to debug it, you can fix the order by providing
110
+ # the seed, which is printed after each run.
111
+ # --seed 1234
112
+ config.order = :random
113
+
114
+ # Seed global randomization in this process using the `--seed` CLI option.
115
+ # Setting this allows you to use `--seed` to deterministically reproduce
116
+ # test failures related to randomization by passing the same `--seed` value
117
+ # as the one that triggered the failure.
118
+ Kernel.srand config.seed
119
+ =end
120
+ end