cuprum-collections 0.5.0 → 0.6.0.rc.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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/README.md +1 -1
  4. data/config/locales/en.rb +18 -0
  5. data/lib/cuprum/collections/adaptable/collection.rb +18 -0
  6. data/lib/cuprum/collections/adaptable/command.rb +22 -0
  7. data/lib/cuprum/collections/adaptable/commands/abstract_assign_one.rb +27 -0
  8. data/lib/cuprum/collections/adaptable/commands/abstract_build_one.rb +25 -0
  9. data/lib/cuprum/collections/adaptable/commands/abstract_validate_one.rb +35 -0
  10. data/lib/cuprum/collections/adaptable/commands.rb +15 -0
  11. data/lib/cuprum/collections/adaptable/query.rb +64 -0
  12. data/lib/cuprum/collections/adaptable.rb +13 -0
  13. data/lib/cuprum/collections/adapter.rb +300 -0
  14. data/lib/cuprum/collections/adapters/data_adapter.rb +82 -0
  15. data/lib/cuprum/collections/adapters/entity_adapter.rb +76 -0
  16. data/lib/cuprum/collections/adapters/hash_adapter.rb +48 -0
  17. data/lib/cuprum/collections/adapters.rb +14 -0
  18. data/lib/cuprum/collections/basic/collection.rb +2 -20
  19. data/lib/cuprum/collections/basic/commands/destroy_one.rb +1 -1
  20. data/lib/cuprum/collections/basic/commands/find_many.rb +0 -31
  21. data/lib/cuprum/collections/basic/commands/find_matching.rb +0 -94
  22. data/lib/cuprum/collections/basic/commands/find_one.rb +0 -18
  23. data/lib/cuprum/collections/basic/commands/insert_one.rb +1 -1
  24. data/lib/cuprum/collections/basic/commands/update_one.rb +1 -1
  25. data/lib/cuprum/collections/basic/scopes/criteria_scope.rb +36 -21
  26. data/lib/cuprum/collections/basic.rb +6 -5
  27. data/lib/cuprum/collections/collection.rb +6 -0
  28. data/lib/cuprum/collections/collection_command.rb +1 -1
  29. data/lib/cuprum/collections/commands/abstract_find_many.rb +40 -3
  30. data/lib/cuprum/collections/commands/abstract_find_matching.rb +102 -0
  31. data/lib/cuprum/collections/commands/abstract_find_one.rb +23 -1
  32. data/lib/cuprum/collections/commands/associations/find_many.rb +1 -3
  33. data/lib/cuprum/collections/commands/associations/require_many.rb +1 -1
  34. data/lib/cuprum/collections/commands/find_one_matching.rb +10 -10
  35. data/lib/cuprum/collections/commands/query_command.rb +6 -4
  36. data/lib/cuprum/collections/commands/upsert.rb +0 -2
  37. data/lib/cuprum/collections/constraints/order/attributes_array.rb +5 -4
  38. data/lib/cuprum/collections/constraints/order/attributes_hash.rb +5 -4
  39. data/lib/cuprum/collections/constraints/order/sort_direction.rb +2 -2
  40. data/lib/cuprum/collections/constraints/ordering.rb +11 -9
  41. data/lib/cuprum/collections/constraints/query_hash.rb +2 -2
  42. data/lib/cuprum/collections/errors/abstract_find_error.rb +101 -23
  43. data/lib/cuprum/collections/errors/extra_attributes.rb +3 -3
  44. data/lib/cuprum/collections/errors/failed_validation.rb +3 -3
  45. data/lib/cuprum/collections/errors/missing_default_contract.rb +12 -4
  46. data/lib/cuprum/collections/queries.rb +4 -0
  47. data/lib/cuprum/collections/relation.rb +0 -2
  48. data/lib/cuprum/collections/relations/parameters.rb +120 -68
  49. data/lib/cuprum/collections/repository.rb +71 -6
  50. data/lib/cuprum/collections/rspec/contracts/query_contracts.rb +23 -4
  51. data/lib/cuprum/collections/rspec/contracts/repository_contracts.rb +18 -0
  52. data/lib/cuprum/collections/rspec/contracts/scope_contracts.rb +51 -0
  53. data/lib/cuprum/collections/rspec/contracts/scopes/builder_contracts.rb +10 -0
  54. data/lib/cuprum/collections/rspec/contracts/scopes/composition_contracts.rb +8 -0
  55. data/lib/cuprum/collections/rspec/contracts/scopes/criteria_contracts.rb +18 -366
  56. data/lib/cuprum/collections/rspec/contracts/scopes/logical_contracts.rb +30 -0
  57. data/lib/cuprum/collections/rspec/contracts/scopes.rb +2 -0
  58. data/lib/cuprum/collections/rspec/contracts.rb +2 -10
  59. data/lib/cuprum/collections/rspec/deferred/adapter_examples.rb +1077 -0
  60. data/lib/cuprum/collections/rspec/deferred/collection_examples.rb +27 -7
  61. data/lib/cuprum/collections/rspec/deferred/commands/assign_one_examples.rb +4 -4
  62. data/lib/cuprum/collections/rspec/deferred/commands/build_one_examples.rb +2 -2
  63. data/lib/cuprum/collections/rspec/deferred/commands/destroy_one_examples.rb +2 -2
  64. data/lib/cuprum/collections/rspec/deferred/commands/find_many_examples.rb +5 -5
  65. data/lib/cuprum/collections/rspec/deferred/commands/find_matching_examples.rb +45 -12
  66. data/lib/cuprum/collections/rspec/deferred/commands/find_one_examples.rb +2 -2
  67. data/lib/cuprum/collections/rspec/deferred/commands/insert_one_examples.rb +1 -1
  68. data/lib/cuprum/collections/rspec/deferred/commands/update_one_examples.rb +1 -1
  69. data/lib/cuprum/collections/rspec/deferred/query_examples.rb +930 -0
  70. data/lib/cuprum/collections/rspec/deferred/relation_examples.rb +48 -17
  71. data/lib/cuprum/collections/rspec/deferred/repository_examples.rb +961 -0
  72. data/lib/cuprum/collections/rspec/deferred/scope_examples.rb +598 -0
  73. data/lib/cuprum/collections/rspec/deferred/scopes/all_examples.rb +391 -0
  74. data/lib/cuprum/collections/rspec/deferred/scopes/builder_examples.rb +857 -0
  75. data/lib/cuprum/collections/rspec/deferred/scopes/composition_examples.rb +93 -0
  76. data/lib/cuprum/collections/rspec/deferred/scopes/conjunction_examples.rb +438 -0
  77. data/lib/cuprum/collections/rspec/deferred/scopes/criteria_examples.rb +1941 -0
  78. data/lib/cuprum/collections/rspec/deferred/scopes/disjunction_examples.rb +415 -0
  79. data/lib/cuprum/collections/rspec/deferred/scopes/none_examples.rb +385 -0
  80. data/lib/cuprum/collections/rspec/deferred/scopes/parser_examples.rb +740 -0
  81. data/lib/cuprum/collections/rspec/deferred/scopes.rb +8 -0
  82. data/lib/cuprum/collections/scope.rb +2 -2
  83. data/lib/cuprum/collections/scopes/container.rb +5 -4
  84. data/lib/cuprum/collections/scopes/criteria/parser.rb +24 -48
  85. data/lib/cuprum/collections/scopes/criteria.rb +7 -6
  86. data/lib/cuprum/collections/version.rb +3 -3
  87. data/lib/cuprum/collections.rb +5 -1
  88. metadata +48 -11
  89. data/lib/cuprum/collections/rspec/contracts/association_contracts.rb +0 -2127
  90. data/lib/cuprum/collections/rspec/contracts/basic.rb +0 -11
  91. data/lib/cuprum/collections/rspec/contracts/collection_contracts.rb +0 -387
  92. data/lib/cuprum/collections/rspec/contracts/command_contracts.rb +0 -169
  93. data/lib/cuprum/collections/rspec/contracts/relation_contracts.rb +0 -1264
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cuprum/collections/rspec/contracts'
4
-
5
- module Cuprum::Collections::RSpec::Contracts
6
- # Namespace for RSpec contract objects for Basic collections.
7
- module Basic
8
- autoload :CommandContracts,
9
- 'cuprum/collections/rspec/contracts/basic/command_contracts'
10
- end
11
- end
@@ -1,387 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cuprum/collections/rspec/contracts'
4
- require 'cuprum/collections/rspec/contracts/relation_contracts'
5
-
6
- module Cuprum::Collections::RSpec::Contracts
7
- # Contracts for asserting on Collection objects.
8
- #
9
- # @deprecated 0.5.0 Collection contracts are deprecated. Use
10
- # Deferred::CollectionExamples instead.
11
- module CollectionContracts
12
- include Cuprum::Collections::RSpec::Contracts::RelationContracts
13
-
14
- # Contract validating the behavior of a Collection.
15
- module ShouldBeACollectionContract
16
- extend RSpec::SleepingKingStudios::Contract
17
-
18
- # @!method apply(example_group, **options)
19
- # Adds the contract to the example group.
20
- #
21
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
22
- # which the contract is applied.
23
- # @param options [Hash] additional options for the contract.
24
- #
25
- # @option options abstract [Boolean] if true, the collection is an
26
- # abstract base class and does not define a query or commands.
27
- # @option options default_entity_class [Class] the default entity class
28
- # for the collection, if any.
29
-
30
- contract do |**options|
31
- shared_context 'when initialized with a scope' do
32
- let(:initial_scope) do
33
- Cuprum::Collections::Scope.new({ 'ok' => true })
34
- end
35
- let(:constructor_options) do
36
- super().merge(scope: initial_scope)
37
- end
38
- end
39
-
40
- shared_examples 'should define the command' \
41
- do |command_name, command_class_name = nil|
42
- next if options[:abstract]
43
-
44
- tools = SleepingKingStudios::Tools::Toolbelt.instance
45
- class_name = tools.str.camelize(command_name)
46
-
47
- describe "##{command_name}" do
48
- let(:constructor_options) { defined?(super()) ? super() : {} }
49
- let(:command) { build_command(collection) }
50
- let(:command_class) do
51
- (
52
- command_class_name ||
53
- "#{options[:commands_namespace]}::#{class_name}"
54
- )
55
- .then { |str| Object.const_get(str) }
56
- end
57
-
58
- define_method(:build_command) do |collection|
59
- collection.send(command_name, **constructor_options)
60
- end
61
-
62
- it 'should define the command' do
63
- expect(collection)
64
- .to respond_to(command_name)
65
- .with(0).arguments
66
- .and_any_keywords
67
- end
68
-
69
- it { expect(command).to be_a command_class }
70
-
71
- it { expect(command.collection).to be subject }
72
- end
73
- end
74
-
75
- include_contract 'should be a relation',
76
- constructor: false,
77
- default_entity_class: options[:default_entity_class]
78
-
79
- include_contract 'should define primary keys'
80
-
81
- include_examples 'should define the command', :assign_one
82
-
83
- include_examples 'should define the command', :build_one
84
-
85
- include_examples 'should define the command', :destroy_one
86
-
87
- include_examples 'should define the command', :find_many
88
-
89
- include_examples 'should define the command', :find_matching
90
-
91
- include_examples 'should define the command', :find_one
92
-
93
- include_examples 'should define the command', :insert_one
94
-
95
- include_examples 'should define the command', :update_one
96
-
97
- include_examples 'should define the command', :validate_one
98
-
99
- describe '#==' do
100
- let(:other_options) { { name: } }
101
- let(:other_collection) { described_class.new(**other_options) }
102
-
103
- describe 'with nil' do
104
- it { expect(collection == nil).to be false } # rubocop:disable Style/NilComparison
105
- end
106
-
107
- describe 'with an object' do
108
- it { expect(collection == Object.new.freeze).to be false }
109
- end
110
-
111
- describe 'with a collection with non-matching properties' do
112
- let(:other_options) { super().merge(custom_option: 'value') }
113
-
114
- it { expect(collection == other_collection).to be false }
115
- end
116
-
117
- describe 'with a collection with matching properties' do
118
- it { expect(collection == other_collection).to be true }
119
- end
120
-
121
- describe 'with another type of collection' do
122
- let(:other_collection) do
123
- Spec::OtherCollection.new(**other_options)
124
- end
125
-
126
- example_class 'Spec::OtherCollection',
127
- Cuprum::Collections::Collection
128
-
129
- it { expect(collection == other_collection).to be false }
130
- end
131
-
132
- context 'when initialized with options' do
133
- let(:constructor_options) do
134
- super().merge(
135
- qualified_name: 'spec/scoped_books',
136
- singular_name: 'grimoire'
137
- )
138
- end
139
-
140
- describe 'with a collection with non-matching properties' do
141
- it { expect(collection == other_collection).to be false }
142
- end
143
-
144
- describe 'with a collection with matching properties' do
145
- let(:other_options) do
146
- super().merge(
147
- qualified_name: 'spec/scoped_books',
148
- singular_name: 'grimoire'
149
- )
150
- end
151
-
152
- it { expect(collection == other_collection).to be true }
153
- end
154
- end
155
- end
156
-
157
- describe '#count' do
158
- it { expect(collection).to respond_to(:count).with(0).arguments }
159
-
160
- it { expect(collection).to have_aliased_method(:count).as(:size) }
161
-
162
- next if options[:abstract]
163
-
164
- it { expect(collection.count).to be 0 }
165
-
166
- wrap_context 'when the collection has many items' do
167
- it { expect(collection.count).to be items.count }
168
- end
169
- end
170
-
171
- describe '#matches?' do
172
- def tools
173
- SleepingKingStudios::Tools::Toolbelt.instance
174
- end
175
-
176
- it 'should define the method' do
177
- expect(collection)
178
- .to respond_to(:matches?)
179
- .with(0).arguments
180
- .and_any_keywords
181
- end
182
-
183
- describe 'with no options' do
184
- it { expect(collection.matches?).to be true }
185
- end
186
-
187
- describe 'with non-matching entity class as a Class' do
188
- let(:other_options) { { entity_class: Grimoire } }
189
-
190
- it { expect(collection.matches?(**other_options)).to be false }
191
- end
192
-
193
- describe 'with non-matching entity class as a String' do
194
- let(:other_options) { { entity_class: 'Grimoire' } }
195
-
196
- it { expect(collection.matches?(**other_options)).to be false }
197
- end
198
-
199
- describe 'with non-matching name' do
200
- it { expect(collection.matches?(name: 'grimoires')).to be false }
201
- end
202
-
203
- describe 'with non-matching primary key name' do
204
- let(:other_options) { { primary_key_name: 'uuid' } }
205
-
206
- it { expect(collection.matches?(**other_options)).to be false }
207
- end
208
-
209
- describe 'with non-matching primary key type' do
210
- let(:other_options) { { primary_key_type: String } }
211
-
212
- it { expect(collection.matches?(**other_options)).to be false }
213
- end
214
-
215
- describe 'with non-matching qualified name' do
216
- let(:other_options) { { qualified_name: 'spec/scoped_books' } }
217
-
218
- it { expect(collection.matches?(**other_options)).to be false }
219
- end
220
-
221
- describe 'with non-matching singular name' do
222
- let(:other_options) { { singular_name: 'grimoire' } }
223
-
224
- it { expect(collection.matches?(**other_options)).to be false }
225
- end
226
-
227
- describe 'with non-matching custom options' do
228
- let(:other_options) { { custom_option: 'custom value' } }
229
-
230
- it { expect(collection.matches?(**other_options)).to be false }
231
- end
232
-
233
- describe 'with partially-matching options' do
234
- let(:other_options) do
235
- {
236
- name:,
237
- singular_name: 'grimoire'
238
- }
239
- end
240
-
241
- it { expect(collection.matches?(**other_options)).to be false }
242
- end
243
-
244
- describe 'with matching entity class as a Class' do
245
- let(:configured_entity_class) do
246
- options.fetch(:default_entity_class, Book)
247
- end
248
- let(:other_options) { { entity_class: configured_entity_class } }
249
-
250
- it { expect(collection.matches?(**other_options)).to be true }
251
- end
252
-
253
- describe 'with matching entity class as a String' do
254
- let(:configured_entity_class) do
255
- options.fetch(:default_entity_class, Book)
256
- end
257
- let(:other_options) do
258
- { entity_class: configured_entity_class.to_s }
259
- end
260
-
261
- it { expect(collection.matches?(**other_options)).to be true }
262
- end
263
-
264
- describe 'with matching name' do
265
- let(:other_options) { { name: } }
266
-
267
- it { expect(collection.matches?(**other_options)).to be true }
268
- end
269
-
270
- describe 'with matching primary key name' do
271
- let(:other_options) { { primary_key_name: 'id' } }
272
-
273
- it { expect(collection.matches?(**other_options)).to be true }
274
- end
275
-
276
- describe 'with matching primary key type' do
277
- let(:other_options) { { primary_key_type: Integer } }
278
-
279
- it { expect(collection.matches?(**other_options)).to be true }
280
- end
281
-
282
- describe 'with matching qualified name' do
283
- let(:other_options) { { qualified_name: name } }
284
-
285
- it { expect(collection.matches?(**other_options)).to be true }
286
- end
287
-
288
- describe 'with matching singular name' do
289
- let(:other_options) do
290
- { singular_name: tools.str.singularize(name) }
291
- end
292
-
293
- it { expect(collection.matches?(**other_options)).to be true }
294
- end
295
-
296
- describe 'with multiple matching options' do
297
- let(:other_options) do
298
- {
299
- name:,
300
- primary_key_name: 'id',
301
- qualified_name: name
302
- }
303
- end
304
-
305
- it { expect(collection.matches?(**other_options)).to be true }
306
- end
307
- end
308
-
309
- describe '#query' do
310
- let(:error_message) do
311
- "#{described_class.name} is an abstract class. Define a " \
312
- 'collection subclass and implement the #query method.'
313
- end
314
- let(:default_order) { defined?(super()) ? super() : {} }
315
- let(:query) { collection.query }
316
-
317
- it { expect(collection).to respond_to(:query).with(0).arguments }
318
-
319
- if options[:abstract]
320
- it 'should raise an exception' do
321
- expect { collection.query }
322
- .to raise_error(
323
- described_class::AbstractCollectionError,
324
- error_message
325
- )
326
- end
327
- else
328
- it { expect(collection.query).to be_a query_class }
329
-
330
- it 'should set the query options' do
331
- query_options.each do |option, value|
332
- expect(collection.query.send(option)).to be == value
333
- end
334
- end
335
-
336
- it { expect(query.limit).to be nil }
337
-
338
- it { expect(query.offset).to be nil }
339
-
340
- it { expect(query.order).to be == default_order }
341
-
342
- it { expect(query.scope).to be == subject.scope }
343
-
344
- wrap_context 'when initialized with a scope' do
345
- it { expect(query.scope).to be == subject.scope }
346
- end
347
- end
348
- end
349
-
350
- describe '#scope' do
351
- let(:expected) do
352
- Cuprum::Collections::Scopes::AllScope.new
353
- end
354
-
355
- include_examples 'should define reader', :scope, -> { be == expected }
356
-
357
- wrap_context 'when initialized with a scope' do
358
- it { expect(subject.scope).to be == initial_scope }
359
- end
360
- end
361
-
362
- describe '#with_scope' do
363
- let(:other_scope) do
364
- Cuprum::Collections::Scope.new({ 'secret' => '12345' })
365
- end
366
- let(:copy) { subject.with_scope(other_scope) }
367
-
368
- it { expect(subject).to respond_to(:with_scope).with(1).argument }
369
-
370
- it { expect(copy).to be_a described_class }
371
-
372
- it { expect(copy).not_to be subject }
373
-
374
- it { expect(copy.scope).to be == other_scope }
375
-
376
- wrap_context 'when initialized with a scope' do
377
- let(:expected) do
378
- initial_scope.and(other_scope)
379
- end
380
-
381
- it { expect(copy.scope).to be == expected }
382
- end
383
- end
384
- end
385
- end
386
- end
387
- end
@@ -1,169 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cuprum/rspec/deferred/parameter_validation_examples'
4
-
5
- require 'cuprum/collections/rspec/contracts'
6
-
7
- module Cuprum::Collections::RSpec::Contracts
8
- # Contracts for asserting on Command objects.
9
- #
10
- # @deprecated 0.5.0 Command contracts are deprecated. Use Deferred::Commands
11
- # examples instead.
12
- module CommandContracts
13
- include Cuprum::RSpec::Deferred::ParameterValidationExamples
14
-
15
- # :nocov:
16
-
17
- # Contract validating the behavior of an AssignOne command implementation.
18
- module ShouldBeAnAssignOneCommandContract
19
- extend RSpec::SleepingKingStudios::Contract
20
-
21
- # @!method apply(example_group, allow_extra_attributes:)
22
- # Adds the contract to the example group.
23
- #
24
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
25
- # which the contract is applied.
26
- # @param allow_extra_attributes [Boolean] if false, the command should
27
- # fail if given attributes not defined for the entity.
28
- contract do |**|
29
- pending \
30
- 'Command contracts are deprecated. Use `include_deferred "should ' \
31
- 'implement the AssignOne command"` instead.'
32
- end
33
- end
34
-
35
- # Contract validating the behavior of a Build command implementation.
36
- module ShouldBeABuildOneCommandContract
37
- extend RSpec::SleepingKingStudios::Contract
38
-
39
- # @!method apply(example_group, allow_extra_attributes:)
40
- # Adds the contract to the example group.
41
- #
42
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
43
- # which the contract is applied.
44
- # @param allow_extra_attributes [Boolean] if false, the command should
45
- # fail if given attributes not defined for the entity.
46
- contract do |**|
47
- pending \
48
- 'Command contracts are deprecated. Use `include_deferred "should ' \
49
- 'implement the BuildOne command"` instead.'
50
- end
51
- end
52
-
53
- # Contract validating the behavior of a DestroyOne command implementation.
54
- module ShouldBeADestroyOneCommandContract
55
- extend RSpec::SleepingKingStudios::Contract
56
-
57
- # @!method apply(example_group)
58
- # Adds the contract to the example group.
59
- #
60
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
61
- # which the contract is applied.
62
- contract do
63
- pending \
64
- 'Command contracts are deprecated. Use `include_deferred "should ' \
65
- 'implement the DestroyOne command"` instead.'
66
- end
67
- end
68
-
69
- # Contract validating the behavior of a FindMany command implementation.
70
- module ShouldBeAFindManyCommandContract
71
- extend RSpec::SleepingKingStudios::Contract
72
-
73
- # @!method apply(example_group)
74
- # Adds the contract to the example group.
75
- #
76
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
77
- # which the contract is applied.
78
- contract do
79
- pending \
80
- 'Command contracts are deprecated. Use `include_deferred "should ' \
81
- 'implement the FindMany command"` instead.'
82
- end
83
- end
84
-
85
- # Contract validating the behavior of a FindMatching command implementation.
86
- module ShouldBeAFindMatchingCommandContract
87
- extend RSpec::SleepingKingStudios::Contract
88
-
89
- # @!method apply(example_group)
90
- # Adds the contract to the example group.
91
- #
92
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
93
- # which the contract is applied.
94
- contract do
95
- pending \
96
- 'Command contracts are deprecated. Use `include_deferred "should ' \
97
- 'implement the FindMatching command"` instead.'
98
- end
99
- end
100
-
101
- # Contract validating the behavior of a FindOne command implementation.
102
- module ShouldBeAFindOneCommandContract
103
- extend RSpec::SleepingKingStudios::Contract
104
-
105
- # @!method apply(example_group)
106
- # Adds the contract to the example group.
107
- #
108
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
109
- # which the contract is applied.
110
- contract do
111
- pending \
112
- 'Command contracts are deprecated. Use `include_deferred "should ' \
113
- 'implement the FindOne command"` instead.'
114
- end
115
- end
116
-
117
- # Contract validating the behavior of an InsertOne command implementation.
118
- module ShouldBeAnInsertOneCommandContract
119
- extend RSpec::SleepingKingStudios::Contract
120
-
121
- # @!method apply(example_group)
122
- # Adds the contract to the example group.
123
- #
124
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
125
- # which the contract is applied.
126
- contract do
127
- pending \
128
- 'Command contracts are deprecated. Use `include_deferred "should ' \
129
- 'implement the InsertOne command"` instead.'
130
- end
131
- end
132
-
133
- # Contract validating the behavior of an UpdateOne command implementation.
134
- module ShouldBeAnUpdateOneCommandContract
135
- extend RSpec::SleepingKingStudios::Contract
136
-
137
- # @!method apply(example_group)
138
- # Adds the contract to the example group.
139
- #
140
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
141
- # which the contract is applied.
142
- contract do
143
- pending \
144
- 'Command contracts are deprecated. Use `include_deferred "should ' \
145
- 'implement the UpdateOne command"` instead.'
146
- end
147
- end
148
-
149
- # Contract validating the behavior of a ValidateOne command implementation.
150
- module ShouldBeAValidateOneCommandContract
151
- extend RSpec::SleepingKingStudios::Contract
152
-
153
- # @!method apply(example_group, default_contract:)
154
- # Adds the contract to the example group.
155
- #
156
- # @param default_contract [Boolean] if true, the command defines a
157
- # default contract.
158
- # @param example_group [RSpec::Core::ExampleGroup] the example group to
159
- # which the contract is applied.
160
- contract do |**|
161
- pending \
162
- 'Command contracts are deprecated. Use `include_deferred "should ' \
163
- 'implement the ValidateOne command"` instead.'
164
- end
165
- end
166
-
167
- # :nocov:
168
- end
169
- end