dm-core 0.10.2 → 1.0.0.rc1
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.
- data/.gitignore +10 -1
- data/Gemfile +143 -0
- data/Rakefile +9 -5
- data/VERSION +1 -1
- data/dm-core.gemspec +160 -57
- data/lib/dm-core.rb +131 -56
- data/lib/dm-core/adapters.rb +98 -14
- data/lib/dm-core/adapters/abstract_adapter.rb +24 -4
- data/lib/dm-core/adapters/in_memory_adapter.rb +7 -2
- data/lib/dm-core/associations/many_to_many.rb +19 -30
- data/lib/dm-core/associations/many_to_one.rb +58 -42
- data/lib/dm-core/associations/one_to_many.rb +33 -23
- data/lib/dm-core/associations/one_to_one.rb +27 -11
- data/lib/dm-core/associations/relationship.rb +4 -4
- data/lib/dm-core/collection.rb +23 -16
- data/lib/dm-core/core_ext/array.rb +36 -0
- data/lib/dm-core/core_ext/hash.rb +30 -0
- data/lib/dm-core/core_ext/module.rb +46 -0
- data/lib/dm-core/core_ext/object.rb +31 -0
- data/lib/dm-core/core_ext/pathname.rb +20 -0
- data/lib/dm-core/core_ext/string.rb +22 -0
- data/lib/dm-core/core_ext/try_dup.rb +44 -0
- data/lib/dm-core/model.rb +88 -27
- data/lib/dm-core/model/hook.rb +75 -18
- data/lib/dm-core/model/property.rb +50 -9
- data/lib/dm-core/model/relationship.rb +31 -31
- data/lib/dm-core/model/scope.rb +3 -3
- data/lib/dm-core/property.rb +196 -516
- data/lib/dm-core/property/binary.rb +7 -0
- data/lib/dm-core/property/boolean.rb +35 -0
- data/lib/dm-core/property/class.rb +24 -0
- data/lib/dm-core/property/date.rb +47 -0
- data/lib/dm-core/property/date_time.rb +48 -0
- data/lib/dm-core/property/decimal.rb +43 -0
- data/lib/dm-core/property/discriminator.rb +48 -0
- data/lib/dm-core/property/float.rb +24 -0
- data/lib/dm-core/property/integer.rb +32 -0
- data/lib/dm-core/property/numeric.rb +43 -0
- data/lib/dm-core/property/object.rb +32 -0
- data/lib/dm-core/property/serial.rb +8 -0
- data/lib/dm-core/property/string.rb +49 -0
- data/lib/dm-core/property/text.rb +12 -0
- data/lib/dm-core/property/time.rb +48 -0
- data/lib/dm-core/property/typecast/numeric.rb +32 -0
- data/lib/dm-core/property/typecast/time.rb +28 -0
- data/lib/dm-core/property_set.rb +10 -4
- data/lib/dm-core/query.rb +14 -37
- data/lib/dm-core/query/conditions/comparison.rb +8 -6
- data/lib/dm-core/query/conditions/operation.rb +33 -2
- data/lib/dm-core/query/operator.rb +2 -5
- data/lib/dm-core/query/path.rb +4 -6
- data/lib/dm-core/repository.rb +21 -6
- data/lib/dm-core/resource.rb +316 -133
- data/lib/dm-core/resource/state.rb +79 -0
- data/lib/dm-core/resource/state/clean.rb +40 -0
- data/lib/dm-core/resource/state/deleted.rb +30 -0
- data/lib/dm-core/resource/state/dirty.rb +86 -0
- data/lib/dm-core/resource/state/immutable.rb +34 -0
- data/lib/dm-core/resource/state/persisted.rb +29 -0
- data/lib/dm-core/resource/state/transient.rb +70 -0
- data/lib/dm-core/spec/lib/adapter_helpers.rb +52 -0
- data/lib/dm-core/spec/lib/collection_helpers.rb +20 -0
- data/{spec → lib/dm-core/spec}/lib/counter_adapter.rb +5 -1
- data/lib/dm-core/spec/lib/pending_helpers.rb +50 -0
- data/lib/dm-core/spec/lib/spec_helper.rb +68 -0
- data/lib/dm-core/spec/setup.rb +165 -0
- data/lib/dm-core/spec/{adapter_shared_spec.rb → shared/adapter_spec.rb} +21 -7
- data/{spec/public/shared/resource_shared_spec.rb → lib/dm-core/spec/shared/resource_spec.rb} +120 -83
- data/{spec/public/shared/sel_shared_spec.rb → lib/dm-core/spec/shared/sel_spec.rb} +5 -6
- data/lib/dm-core/support/assertions.rb +8 -0
- data/lib/dm-core/support/equalizer.rb +1 -0
- data/lib/dm-core/support/hook.rb +420 -0
- data/lib/dm-core/support/lazy_array.rb +453 -0
- data/lib/dm-core/support/local_object_space.rb +12 -0
- data/lib/dm-core/support/logger.rb +193 -6
- data/lib/dm-core/support/naming_conventions.rb +8 -8
- data/lib/dm-core/support/subject.rb +33 -0
- data/lib/dm-core/type.rb +4 -0
- data/lib/dm-core/types/boolean.rb +2 -0
- data/lib/dm-core/types/decimal.rb +9 -0
- data/lib/dm-core/types/discriminator.rb +2 -0
- data/lib/dm-core/types/object.rb +3 -0
- data/lib/dm-core/types/serial.rb +2 -0
- data/lib/dm-core/types/text.rb +2 -0
- data/lib/dm-core/version.rb +1 -1
- data/spec/public/associations/many_to_many/read_multiple_join_spec.rb +67 -0
- data/spec/public/model/hook_spec.rb +209 -0
- data/spec/public/model/property_spec.rb +35 -0
- data/spec/public/model/relationship_spec.rb +33 -20
- data/spec/public/model_spec.rb +142 -10
- data/spec/public/property/binary_spec.rb +14 -0
- data/spec/public/property/boolean_spec.rb +14 -0
- data/spec/public/property/class_spec.rb +20 -0
- data/spec/public/property/date_spec.rb +14 -0
- data/spec/public/property/date_time_spec.rb +14 -0
- data/spec/public/property/decimal_spec.rb +14 -0
- data/spec/public/{types → property}/discriminator_spec.rb +2 -12
- data/spec/public/property/float_spec.rb +14 -0
- data/spec/public/property/integer_spec.rb +14 -0
- data/spec/public/property/object_spec.rb +9 -17
- data/spec/public/property/serial_spec.rb +14 -0
- data/spec/public/property/string_spec.rb +14 -0
- data/spec/public/property/text_spec.rb +52 -0
- data/spec/public/property/time_spec.rb +14 -0
- data/spec/public/property_spec.rb +28 -87
- data/spec/public/resource_spec.rb +101 -0
- data/spec/public/sel_spec.rb +5 -15
- data/spec/public/shared/collection_shared_spec.rb +16 -30
- data/spec/public/shared/finder_shared_spec.rb +2 -4
- data/spec/public/shared/property_shared_spec.rb +176 -0
- data/spec/semipublic/adapters/abstract_adapter_spec.rb +1 -1
- data/spec/semipublic/adapters/in_memory_adapter_spec.rb +2 -2
- data/spec/semipublic/associations/many_to_many_spec.rb +89 -0
- data/spec/semipublic/associations/many_to_one_spec.rb +24 -1
- data/spec/semipublic/associations/one_to_many_spec.rb +51 -0
- data/spec/semipublic/associations/one_to_one_spec.rb +49 -0
- data/spec/semipublic/associations/relationship_spec.rb +3 -3
- data/spec/semipublic/associations_spec.rb +1 -1
- data/spec/semipublic/property/binary_spec.rb +13 -0
- data/spec/semipublic/property/boolean_spec.rb +65 -0
- data/spec/semipublic/property/class_spec.rb +33 -0
- data/spec/semipublic/property/date_spec.rb +43 -0
- data/spec/semipublic/property/date_time_spec.rb +46 -0
- data/spec/semipublic/property/decimal_spec.rb +82 -0
- data/spec/semipublic/property/discriminator_spec.rb +19 -0
- data/spec/semipublic/property/float_spec.rb +82 -0
- data/spec/semipublic/property/integer_spec.rb +82 -0
- data/spec/semipublic/property/serial_spec.rb +13 -0
- data/spec/semipublic/property/string_spec.rb +13 -0
- data/spec/semipublic/property/text_spec.rb +31 -0
- data/spec/semipublic/property/time_spec.rb +50 -0
- data/spec/semipublic/property_spec.rb +2 -532
- data/spec/semipublic/query/conditions/comparison_spec.rb +171 -169
- data/spec/semipublic/query/conditions/operation_spec.rb +53 -51
- data/spec/semipublic/query/path_spec.rb +17 -17
- data/spec/semipublic/query_spec.rb +47 -78
- data/spec/semipublic/resource/state/clean_spec.rb +88 -0
- data/spec/semipublic/resource/state/deleted_spec.rb +78 -0
- data/spec/semipublic/resource/state/dirty_spec.rb +133 -0
- data/spec/semipublic/resource/state/immutable_spec.rb +99 -0
- data/spec/semipublic/resource/state/transient_spec.rb +128 -0
- data/spec/semipublic/resource/state_spec.rb +226 -0
- data/spec/semipublic/shared/property_shared_spec.rb +143 -0
- data/spec/semipublic/shared/resource_shared_spec.rb +16 -15
- data/spec/semipublic/shared/resource_state_shared_spec.rb +78 -0
- data/spec/semipublic/shared/subject_shared_spec.rb +79 -0
- data/spec/spec_helper.rb +21 -97
- data/spec/support/types/huge_integer.rb +17 -0
- data/spec/unit/array_spec.rb +48 -0
- data/spec/unit/hash_spec.rb +35 -0
- data/spec/unit/hook_spec.rb +1234 -0
- data/spec/unit/lazy_array_spec.rb +1959 -0
- data/spec/unit/module_spec.rb +70 -0
- data/spec/unit/object_spec.rb +37 -0
- data/spec/unit/try_dup_spec.rb +45 -0
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +197 -71
- data/deps.rip +0 -2
- data/lib/dm-core/adapters/data_objects_adapter.rb +0 -712
- data/lib/dm-core/adapters/mysql_adapter.rb +0 -42
- data/lib/dm-core/adapters/oracle_adapter.rb +0 -229
- data/lib/dm-core/adapters/postgres_adapter.rb +0 -22
- data/lib/dm-core/adapters/sqlite3_adapter.rb +0 -17
- data/lib/dm-core/adapters/sqlserver_adapter.rb +0 -114
- data/lib/dm-core/adapters/yaml_adapter.rb +0 -111
- data/lib/dm-core/core_ext/enumerable.rb +0 -28
- data/lib/dm-core/migrations.rb +0 -1427
- data/lib/dm-core/spec/data_objects_adapter_shared_spec.rb +0 -366
- data/lib/dm-core/transaction.rb +0 -508
- data/lib/dm-core/types/paranoid_boolean.rb +0 -42
- data/lib/dm-core/types/paranoid_datetime.rb +0 -41
- data/spec/lib/adapter_helpers.rb +0 -105
- data/spec/lib/collection_helpers.rb +0 -18
- data/spec/lib/pending_helpers.rb +0 -46
- data/spec/public/migrations_spec.rb +0 -503
- data/spec/public/transaction_spec.rb +0 -153
- data/spec/semipublic/adapters/mysql_adapter_spec.rb +0 -17
- data/spec/semipublic/adapters/oracle_adapter_spec.rb +0 -194
- data/spec/semipublic/adapters/postgres_adapter_spec.rb +0 -17
- data/spec/semipublic/adapters/sqlite3_adapter_spec.rb +0 -17
- data/spec/semipublic/adapters/sqlserver_adapter_spec.rb +0 -17
- data/spec/semipublic/adapters/yaml_adapter_spec.rb +0 -12
@@ -62,37 +62,37 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do
|
|
62
62
|
|
63
63
|
describe '#==' do
|
64
64
|
describe 'when the other AbstractComparison is equal' do
|
65
|
-
#
|
65
|
+
# artificially modify the object so #== will throw an
|
66
66
|
# exception if the equal? branch is not followed when heckling
|
67
|
-
before { @comparison.
|
67
|
+
before { @comparison.singleton_class.send(:undef_method, :slug) }
|
68
68
|
|
69
69
|
subject { @comparison == @comparison }
|
70
70
|
|
71
|
-
it { should
|
71
|
+
it { should be(true) }
|
72
72
|
end
|
73
73
|
|
74
74
|
describe 'when the other AbstractComparison is the same class' do
|
75
75
|
subject { @comparison == DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value) }
|
76
76
|
|
77
|
-
it { should
|
77
|
+
it { should be(true) }
|
78
78
|
end
|
79
79
|
|
80
80
|
describe 'when the other AbstractComparison is a different class' do
|
81
81
|
subject { @comparison == DataMapper::Query::Conditions::Comparison.new(:other, @property, @value) }
|
82
82
|
|
83
|
-
it { should
|
83
|
+
it { should be(false) }
|
84
84
|
end
|
85
85
|
|
86
86
|
describe 'when the other AbstractComparison is the same class, with different property' do
|
87
87
|
subject { @comparison == DataMapper::Query::Conditions::Comparison.new(@slug, @other_property, @value) }
|
88
88
|
|
89
|
-
it { should
|
89
|
+
it { should be(false) }
|
90
90
|
end
|
91
91
|
|
92
92
|
describe 'when the other AbstractComparison is the same class, with different value' do
|
93
93
|
subject { @comparison == DataMapper::Query::Conditions::Comparison.new(@slug, @property, @other_value) }
|
94
94
|
|
95
|
-
it { should
|
95
|
+
it { should be(false) }
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -100,37 +100,37 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do
|
|
100
100
|
|
101
101
|
describe '#eql?' do
|
102
102
|
describe 'when the other AbstractComparison is equal' do
|
103
|
-
#
|
103
|
+
# artificially modify the object so #eql? will throw an
|
104
104
|
# exception if the equal? branch is not followed when heckling
|
105
|
-
before { @comparison.
|
105
|
+
before { @comparison.singleton_class.send(:undef_method, :slug) }
|
106
106
|
|
107
107
|
subject { @comparison.eql?(@comparison) }
|
108
108
|
|
109
|
-
it { should
|
109
|
+
it { should be(true) }
|
110
110
|
end
|
111
111
|
|
112
112
|
describe 'when the other AbstractComparison is the same class' do
|
113
113
|
subject { @comparison.eql?(DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)) }
|
114
114
|
|
115
|
-
it { should
|
115
|
+
it { should be(true) }
|
116
116
|
end
|
117
117
|
|
118
118
|
describe 'when the other AbstractComparison is a different class' do
|
119
119
|
subject { @comparison.eql?(DataMapper::Query::Conditions::Comparison.new(:other, @property, @value)) }
|
120
120
|
|
121
|
-
it { should
|
121
|
+
it { should be(false) }
|
122
122
|
end
|
123
123
|
|
124
124
|
describe 'when the other AbstractComparison is the same class, with different property' do
|
125
125
|
subject { @comparison.eql?(DataMapper::Query::Conditions::Comparison.new(@slug, @other_property, @value)) }
|
126
126
|
|
127
|
-
it { should
|
127
|
+
it { should be(false) }
|
128
128
|
end
|
129
129
|
|
130
130
|
describe 'when the other AbstractComparison is the same class, with different value' do
|
131
131
|
subject { @comparison.eql?(DataMapper::Query::Conditions::Comparison.new(@slug, @property, @other_value)) }
|
132
132
|
|
133
|
-
it { should
|
133
|
+
it { should be(false) }
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -214,7 +214,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do
|
|
214
214
|
describe '#property?' do
|
215
215
|
subject { @comparison.property? }
|
216
216
|
|
217
|
-
it { should
|
217
|
+
it { should be(true) }
|
218
218
|
end
|
219
219
|
|
220
220
|
it { should respond_to(:slug) }
|
@@ -239,7 +239,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do
|
|
239
239
|
subject { @comparison.valid? }
|
240
240
|
|
241
241
|
describe 'when the value is valid for the subject' do
|
242
|
-
it { should
|
242
|
+
it { should be(true) }
|
243
243
|
end
|
244
244
|
|
245
245
|
describe 'when the value is not valid for the subject' do
|
@@ -247,7 +247,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractComparison' do
|
|
247
247
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, nil)
|
248
248
|
end
|
249
249
|
|
250
|
-
it { should
|
250
|
+
it { should be(false) }
|
251
251
|
end
|
252
252
|
end
|
253
253
|
|
@@ -343,7 +343,7 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
343
343
|
describe '#inspect' do
|
344
344
|
subject { @comparison.inspect }
|
345
345
|
|
346
|
-
it { should == '#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
346
|
+
it { should == '#<DataMapper::Query::Conditions::EqualToComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
347
347
|
end
|
348
348
|
|
349
349
|
it { should respond_to(:matches?) }
|
@@ -355,25 +355,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
355
355
|
describe 'with a matching Hash' do
|
356
356
|
subject { @comparison.matches?(@property.field => 1) }
|
357
357
|
|
358
|
-
it { should
|
358
|
+
it { should be(true) }
|
359
359
|
end
|
360
360
|
|
361
361
|
describe 'with a not matching Hash' do
|
362
362
|
subject { @comparison.matches?(@property.field => 2) }
|
363
363
|
|
364
|
-
it { should
|
364
|
+
it { should be(false) }
|
365
365
|
end
|
366
366
|
|
367
367
|
describe 'with a matching Resource' do
|
368
368
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
369
369
|
|
370
|
-
it { should
|
370
|
+
it { should be(true) }
|
371
371
|
end
|
372
372
|
|
373
373
|
describe 'with a not matching Resource' do
|
374
374
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
375
375
|
|
376
|
-
it { should
|
376
|
+
it { should be(false) }
|
377
377
|
end
|
378
378
|
end
|
379
379
|
|
@@ -385,25 +385,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
385
385
|
describe 'with a matching Hash' do
|
386
386
|
subject { @comparison.matches?(@property.field => nil) }
|
387
387
|
|
388
|
-
it { should
|
388
|
+
it { should be(true) }
|
389
389
|
end
|
390
390
|
|
391
391
|
describe 'with a not matching Hash' do
|
392
392
|
subject { @comparison.matches?(@property.field => 1) }
|
393
393
|
|
394
|
-
it { should
|
394
|
+
it { should be(false) }
|
395
395
|
end
|
396
396
|
|
397
397
|
describe 'with a matching Resource' do
|
398
398
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
399
399
|
|
400
|
-
it { should
|
400
|
+
it { should be(true) }
|
401
401
|
end
|
402
402
|
|
403
403
|
describe 'with a not matching Resource' do
|
404
404
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
405
405
|
|
406
|
-
it { should
|
406
|
+
it { should be(false) }
|
407
407
|
end
|
408
408
|
end
|
409
409
|
end
|
@@ -420,25 +420,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
420
420
|
describe 'with a matching Hash' do
|
421
421
|
subject { @comparison.matches?({ @relationship.field => nil }) }
|
422
422
|
|
423
|
-
it { should
|
423
|
+
it { should be(true) }
|
424
424
|
end
|
425
425
|
|
426
426
|
describe 'with a not matching Hash' do
|
427
427
|
subject { @comparison.matches?({ @relationship.field => {} }) }
|
428
428
|
|
429
|
-
it { pending { should
|
429
|
+
it { pending { should be(false) } }
|
430
430
|
end
|
431
431
|
|
432
432
|
describe 'with a matching Resource' do
|
433
433
|
subject { @comparison.matches?(@parent) }
|
434
434
|
|
435
|
-
it { should
|
435
|
+
it { should be(true) }
|
436
436
|
end
|
437
437
|
|
438
438
|
describe 'with a not matching Resource' do
|
439
439
|
subject { @comparison.matches?(@child) }
|
440
440
|
|
441
|
-
it { should
|
441
|
+
it { should be(false) }
|
442
442
|
end
|
443
443
|
end
|
444
444
|
|
@@ -453,25 +453,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
453
453
|
describe 'with a matching Hash' do
|
454
454
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
455
455
|
|
456
|
-
it { should
|
456
|
+
it { should be(true) }
|
457
457
|
end
|
458
458
|
|
459
459
|
describe 'with a not matching Hash' do
|
460
460
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
461
461
|
|
462
|
-
it { pending { should
|
462
|
+
it { pending { should be(false) } }
|
463
463
|
end
|
464
464
|
|
465
465
|
describe 'with a matching Resource' do
|
466
466
|
subject { @comparison.matches?(@child) }
|
467
467
|
|
468
|
-
it { pending { should
|
468
|
+
it { pending { should be(true) } }
|
469
469
|
end
|
470
470
|
|
471
471
|
describe 'with a not matching Resource' do
|
472
472
|
subject { @comparison.matches?(@parent) }
|
473
473
|
|
474
|
-
it { pending { should
|
474
|
+
it { pending { should be(false) } }
|
475
475
|
end
|
476
476
|
end
|
477
477
|
|
@@ -488,25 +488,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
488
488
|
describe 'with a matching Hash' do
|
489
489
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
490
490
|
|
491
|
-
it { should
|
491
|
+
it { should be(true) }
|
492
492
|
end
|
493
493
|
|
494
494
|
describe 'with a not matching Hash' do
|
495
495
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
496
496
|
|
497
|
-
it { pending { should
|
497
|
+
it { pending { should be(false) } }
|
498
498
|
end
|
499
499
|
|
500
500
|
describe 'with a matching Resource' do
|
501
501
|
subject { @comparison.matches?(@child) }
|
502
502
|
|
503
|
-
it { pending { should
|
503
|
+
it { pending { should be(true) } }
|
504
504
|
end
|
505
505
|
|
506
506
|
describe 'with a not matching Resource' do
|
507
507
|
subject { @comparison.matches?(@parent) }
|
508
508
|
|
509
|
-
it { pending { should
|
509
|
+
it { pending { should be(false) } }
|
510
510
|
end
|
511
511
|
end
|
512
512
|
|
@@ -521,25 +521,25 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
521
521
|
describe 'with a matching Hash' do
|
522
522
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
523
523
|
|
524
|
-
it { pending { should
|
524
|
+
it { pending { should be(true) } }
|
525
525
|
end
|
526
526
|
|
527
527
|
describe 'with a not matching Hash' do
|
528
528
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
529
529
|
|
530
|
-
it { should
|
530
|
+
it { should be(false) }
|
531
531
|
end
|
532
532
|
|
533
533
|
describe 'with a matching Resource' do
|
534
534
|
subject { @comparison.matches?(@child) }
|
535
535
|
|
536
|
-
it { should
|
536
|
+
it { should be(true) }
|
537
537
|
end
|
538
538
|
|
539
539
|
describe 'with a not matching Resource' do
|
540
540
|
subject { @comparison.matches?(@parent) }
|
541
541
|
|
542
|
-
it { should
|
542
|
+
it { should be(false) }
|
543
543
|
end
|
544
544
|
end
|
545
545
|
end
|
@@ -551,7 +551,7 @@ describe DataMapper::Query::Conditions::EqualToComparison do
|
|
551
551
|
describe '#relationship?' do
|
552
552
|
subject { @comparison.relationship? }
|
553
553
|
|
554
|
-
it { should
|
554
|
+
it { should be(false) }
|
555
555
|
end
|
556
556
|
|
557
557
|
it { should respond_to(:to_s) }
|
@@ -645,7 +645,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
645
645
|
describe '#inspect' do
|
646
646
|
subject { @comparison.inspect }
|
647
647
|
|
648
|
-
it { should == '#<DataMapper::Query::Conditions::InclusionComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=[1] @loaded_value=[1]>' }
|
648
|
+
it { should == '#<DataMapper::Query::Conditions::InclusionComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=[1] @loaded_value=[1]>' }
|
649
649
|
end
|
650
650
|
|
651
651
|
it { should respond_to(:matches?) }
|
@@ -657,25 +657,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
657
657
|
describe 'with a matching Hash' do
|
658
658
|
subject { @comparison.matches?(@property.field => 1) }
|
659
659
|
|
660
|
-
it { should
|
660
|
+
it { should be(true) }
|
661
661
|
end
|
662
662
|
|
663
663
|
describe 'with a not matching Hash' do
|
664
664
|
subject { @comparison.matches?(@property.field => 2) }
|
665
665
|
|
666
|
-
it { should
|
666
|
+
it { should be(false) }
|
667
667
|
end
|
668
668
|
|
669
669
|
describe 'with a matching Resource' do
|
670
670
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
671
671
|
|
672
|
-
it { should
|
672
|
+
it { should be(true) }
|
673
673
|
end
|
674
674
|
|
675
675
|
describe 'with a not matching Resource' do
|
676
676
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
677
677
|
|
678
|
-
it { should
|
678
|
+
it { should be(false) }
|
679
679
|
end
|
680
680
|
end
|
681
681
|
|
@@ -688,25 +688,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
688
688
|
describe 'with a matching Hash' do
|
689
689
|
subject { @comparison.matches?(@property.field => 1) }
|
690
690
|
|
691
|
-
it { should
|
691
|
+
it { should be(true) }
|
692
692
|
end
|
693
693
|
|
694
694
|
describe 'with a not matching Hash' do
|
695
695
|
subject { @comparison.matches?(@property.field => 2) }
|
696
696
|
|
697
|
-
it { should
|
697
|
+
it { should be(false) }
|
698
698
|
end
|
699
699
|
|
700
700
|
describe 'with a matching Resource' do
|
701
701
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
702
702
|
|
703
|
-
it { should
|
703
|
+
it { should be(true) }
|
704
704
|
end
|
705
705
|
|
706
706
|
describe 'with a not matching Resource' do
|
707
707
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
708
708
|
|
709
|
-
it { should
|
709
|
+
it { should be(false) }
|
710
710
|
end
|
711
711
|
end
|
712
712
|
|
@@ -719,25 +719,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
719
719
|
describe 'with a matching Hash' do
|
720
720
|
subject { @comparison.matches?(@property.field => 1) }
|
721
721
|
|
722
|
-
it { should
|
722
|
+
it { should be(true) }
|
723
723
|
end
|
724
724
|
|
725
725
|
describe 'with a not matching Hash' do
|
726
726
|
subject { @comparison.matches?(@property.field => 0) }
|
727
727
|
|
728
|
-
it { should
|
728
|
+
it { should be(false) }
|
729
729
|
end
|
730
730
|
|
731
731
|
describe 'with a matching Resource' do
|
732
732
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
733
733
|
|
734
|
-
it { should
|
734
|
+
it { should be(true) }
|
735
735
|
end
|
736
736
|
|
737
737
|
describe 'with a not matching Resource' do
|
738
738
|
subject { @comparison.matches?(@model.new(@property => 0)) }
|
739
739
|
|
740
|
-
it { should
|
740
|
+
it { should be(false) }
|
741
741
|
end
|
742
742
|
end
|
743
743
|
|
@@ -750,25 +750,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
750
750
|
describe 'with a matching Hash' do
|
751
751
|
subject { @comparison.matches?(@property.field => 1) }
|
752
752
|
|
753
|
-
it { should
|
753
|
+
it { should be(true) }
|
754
754
|
end
|
755
755
|
|
756
756
|
describe 'with a not matching Hash' do
|
757
757
|
subject { @comparison.matches?(@property.field => 2) }
|
758
758
|
|
759
|
-
it { should
|
759
|
+
it { should be(false) }
|
760
760
|
end
|
761
761
|
|
762
762
|
describe 'with a matching Resource' do
|
763
763
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
764
764
|
|
765
|
-
it { should
|
765
|
+
it { should be(true) }
|
766
766
|
end
|
767
767
|
|
768
768
|
describe 'with a not matching Resource' do
|
769
769
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
770
770
|
|
771
|
-
it { should
|
771
|
+
it { should be(false) }
|
772
772
|
end
|
773
773
|
end
|
774
774
|
end
|
@@ -785,25 +785,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
785
785
|
describe 'with a matching Hash' do
|
786
786
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
787
787
|
|
788
|
-
it { pending { should
|
788
|
+
it { pending { should be(true) } }
|
789
789
|
end
|
790
790
|
|
791
791
|
describe 'with a not matching Hash' do
|
792
792
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
793
793
|
|
794
|
-
it { should
|
794
|
+
it { should be(false) }
|
795
795
|
end
|
796
796
|
|
797
797
|
describe 'with a matching Resource' do
|
798
798
|
subject { @comparison.matches?(@child) }
|
799
799
|
|
800
|
-
it { should
|
800
|
+
it { should be(true) }
|
801
801
|
end
|
802
802
|
|
803
803
|
describe 'with a not matching Resource' do
|
804
804
|
subject { @comparison.matches?(@parent) }
|
805
805
|
|
806
|
-
it { should
|
806
|
+
it { should be(false) }
|
807
807
|
end
|
808
808
|
end
|
809
809
|
|
@@ -820,25 +820,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
820
820
|
describe 'with a matching Hash' do
|
821
821
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
822
822
|
|
823
|
-
it { should
|
823
|
+
it { should be(true) }
|
824
824
|
end
|
825
825
|
|
826
826
|
describe 'with a not matching Hash' do
|
827
827
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
828
828
|
|
829
|
-
it { pending { should
|
829
|
+
it { pending { should be(false) } }
|
830
830
|
end
|
831
831
|
|
832
832
|
describe 'with a matching Resource' do
|
833
833
|
subject { @comparison.matches?(@child) }
|
834
834
|
|
835
|
-
it { pending { should
|
835
|
+
it { pending { should be(true) } }
|
836
836
|
end
|
837
837
|
|
838
838
|
describe 'with a not matching Resource' do
|
839
839
|
subject { @comparison.matches?(@parent) }
|
840
840
|
|
841
|
-
it { pending { should
|
841
|
+
it { pending { should be(false) } }
|
842
842
|
end
|
843
843
|
end
|
844
844
|
|
@@ -853,25 +853,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
853
853
|
describe 'with a matching Hash' do
|
854
854
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
855
855
|
|
856
|
-
it { pending { should
|
856
|
+
it { pending { should be(true) } }
|
857
857
|
end
|
858
858
|
|
859
859
|
describe 'with a not matching Hash' do
|
860
860
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
861
861
|
|
862
|
-
it { should
|
862
|
+
it { should be(false) }
|
863
863
|
end
|
864
864
|
|
865
865
|
describe 'with a matching Resource' do
|
866
866
|
subject { @comparison.matches?(@child) }
|
867
867
|
|
868
|
-
it { should
|
868
|
+
it { should be(true) }
|
869
869
|
end
|
870
870
|
|
871
871
|
describe 'with a not matching Resource' do
|
872
872
|
subject { @comparison.matches?(@parent) }
|
873
873
|
|
874
|
-
it { should
|
874
|
+
it { should be(false) }
|
875
875
|
end
|
876
876
|
end
|
877
877
|
|
@@ -886,25 +886,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
886
886
|
describe 'with a matching Hash' do
|
887
887
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
888
888
|
|
889
|
-
it { pending { should
|
889
|
+
it { pending { should be(true) } }
|
890
890
|
end
|
891
891
|
|
892
892
|
describe 'with a not matching Hash' do
|
893
893
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
894
894
|
|
895
|
-
it { should
|
895
|
+
it { should be(false) }
|
896
896
|
end
|
897
897
|
|
898
898
|
describe 'with a matching Resource' do
|
899
899
|
subject { @comparison.matches?(@child) }
|
900
900
|
|
901
|
-
it { should
|
901
|
+
it { should be(true) }
|
902
902
|
end
|
903
903
|
|
904
904
|
describe 'with a not matching Resource' do
|
905
905
|
subject { @comparison.matches?(@parent) }
|
906
906
|
|
907
|
-
it { should
|
907
|
+
it { should be(false) }
|
908
908
|
end
|
909
909
|
end
|
910
910
|
|
@@ -919,25 +919,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
919
919
|
describe 'with a matching Hash' do
|
920
920
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
921
921
|
|
922
|
-
it { pending { should
|
922
|
+
it { pending { should be(true) } }
|
923
923
|
end
|
924
924
|
|
925
925
|
describe 'with a not matching Hash' do
|
926
926
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
927
927
|
|
928
|
-
it { should
|
928
|
+
it { should be(false) }
|
929
929
|
end
|
930
930
|
|
931
931
|
describe 'with a matching Resource' do
|
932
932
|
subject { @comparison.matches?(@child) }
|
933
933
|
|
934
|
-
it { should
|
934
|
+
it { should be(true) }
|
935
935
|
end
|
936
936
|
|
937
937
|
describe 'with a not matching Resource' do
|
938
938
|
subject { @comparison.matches?(@parent) }
|
939
939
|
|
940
|
-
it { should
|
940
|
+
it { should be(false) }
|
941
941
|
end
|
942
942
|
end
|
943
943
|
|
@@ -954,25 +954,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
954
954
|
describe 'with a matching Hash' do
|
955
955
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
956
956
|
|
957
|
-
it { should
|
957
|
+
it { should be(true) }
|
958
958
|
end
|
959
959
|
|
960
960
|
describe 'with a not matching Hash' do
|
961
961
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
962
962
|
|
963
|
-
it { pending { should
|
963
|
+
it { pending { should be(false) } }
|
964
964
|
end
|
965
965
|
|
966
966
|
describe 'with a matching Resource' do
|
967
967
|
subject { @comparison.matches?(@child) }
|
968
968
|
|
969
|
-
it { pending { should
|
969
|
+
it { pending { should be(true) } }
|
970
970
|
end
|
971
971
|
|
972
972
|
describe 'with a not matching Resource' do
|
973
973
|
subject { @comparison.matches?(@parent) }
|
974
974
|
|
975
|
-
it { pending { should
|
975
|
+
it { pending { should be(false) } }
|
976
976
|
end
|
977
977
|
end
|
978
978
|
|
@@ -987,25 +987,25 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
987
987
|
describe 'with a matching Hash' do
|
988
988
|
subject { @comparison.matches?({ @relationship.field => @parent.attributes(:field) }) }
|
989
989
|
|
990
|
-
it { pending { should
|
990
|
+
it { pending { should be(true) } }
|
991
991
|
end
|
992
992
|
|
993
993
|
describe 'with a not matching Hash' do
|
994
994
|
subject { @comparison.matches?({ @relationship.field => @child.attributes(:field) }) }
|
995
995
|
|
996
|
-
it { should
|
996
|
+
it { should be(false) }
|
997
997
|
end
|
998
998
|
|
999
999
|
describe 'with a matching Resource' do
|
1000
1000
|
subject { @comparison.matches?(@child) }
|
1001
1001
|
|
1002
|
-
it { should
|
1002
|
+
it { should be(true) }
|
1003
1003
|
end
|
1004
1004
|
|
1005
1005
|
describe 'with a not matching Resource' do
|
1006
1006
|
subject { @comparison.matches?(@parent) }
|
1007
1007
|
|
1008
|
-
it { should
|
1008
|
+
it { should be(false) }
|
1009
1009
|
end
|
1010
1010
|
end
|
1011
1011
|
end
|
@@ -1017,7 +1017,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1017
1017
|
describe '#relationship?' do
|
1018
1018
|
subject { @comparison.relationship? }
|
1019
1019
|
|
1020
|
-
it { should
|
1020
|
+
it { should be(false) }
|
1021
1021
|
end
|
1022
1022
|
|
1023
1023
|
it { should respond_to(:to_s) }
|
@@ -1035,7 +1035,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1035
1035
|
|
1036
1036
|
describe 'with a Property subject' do
|
1037
1037
|
describe 'with a valid Array value' do
|
1038
|
-
it { should
|
1038
|
+
it { should be(true) }
|
1039
1039
|
end
|
1040
1040
|
|
1041
1041
|
describe 'with a valid Array value that needs typecasting' do
|
@@ -1044,7 +1044,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1044
1044
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1045
1045
|
end
|
1046
1046
|
|
1047
|
-
it { should
|
1047
|
+
it { should be(true) }
|
1048
1048
|
end
|
1049
1049
|
|
1050
1050
|
describe 'with an invalid Array value' do
|
@@ -1053,7 +1053,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1053
1053
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1054
1054
|
end
|
1055
1055
|
|
1056
|
-
it { should
|
1056
|
+
it { should be(false) }
|
1057
1057
|
end
|
1058
1058
|
|
1059
1059
|
describe 'with an empty Array value' do
|
@@ -1062,7 +1062,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1062
1062
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1063
1063
|
end
|
1064
1064
|
|
1065
|
-
it { should
|
1065
|
+
it { should be(false) }
|
1066
1066
|
end
|
1067
1067
|
|
1068
1068
|
describe 'with a valid Range value' do
|
@@ -1071,7 +1071,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1071
1071
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1072
1072
|
end
|
1073
1073
|
|
1074
|
-
it { should
|
1074
|
+
it { should be(true) }
|
1075
1075
|
end
|
1076
1076
|
|
1077
1077
|
describe 'with a valid Range value that needs typecasting' do
|
@@ -1080,7 +1080,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1080
1080
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1081
1081
|
end
|
1082
1082
|
|
1083
|
-
it { should
|
1083
|
+
it { should be(true) }
|
1084
1084
|
end
|
1085
1085
|
|
1086
1086
|
describe 'with an invalid Range value' do
|
@@ -1089,7 +1089,7 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1089
1089
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1090
1090
|
end
|
1091
1091
|
|
1092
|
-
it { should
|
1092
|
+
it { should be(false) }
|
1093
1093
|
end
|
1094
1094
|
|
1095
1095
|
describe 'with an empty Range value' do
|
@@ -1098,45 +1098,47 @@ describe DataMapper::Query::Conditions::InclusionComparison do
|
|
1098
1098
|
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @property, @value)
|
1099
1099
|
end
|
1100
1100
|
|
1101
|
-
it { should
|
1101
|
+
it { should be(false) }
|
1102
1102
|
end
|
1103
1103
|
end
|
1104
1104
|
|
1105
1105
|
describe 'with a Relationship subject' do
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1106
|
+
supported_by :all do
|
1107
|
+
describe 'with a valid Array value' do
|
1108
|
+
before do
|
1109
|
+
@value = [ @model.new(:id => 1) ]
|
1110
|
+
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
it { should be(true) }
|
1110
1114
|
end
|
1111
1115
|
|
1112
|
-
|
1113
|
-
|
1116
|
+
describe 'with an invalid Array value' do
|
1117
|
+
before do
|
1118
|
+
@value = [ @model.new ]
|
1119
|
+
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1120
|
+
end
|
1114
1121
|
|
1115
|
-
|
1116
|
-
before do
|
1117
|
-
@value = [ @model.new ]
|
1118
|
-
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1122
|
+
it { should be(false) }
|
1119
1123
|
end
|
1120
1124
|
|
1121
|
-
|
1122
|
-
|
1125
|
+
describe 'with an empty Array value' do
|
1126
|
+
before do
|
1127
|
+
@value = []
|
1128
|
+
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1129
|
+
end
|
1123
1130
|
|
1124
|
-
|
1125
|
-
before do
|
1126
|
-
@value = []
|
1127
|
-
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1131
|
+
it { should be(false) }
|
1128
1132
|
end
|
1129
1133
|
|
1130
|
-
|
1131
|
-
|
1134
|
+
describe 'with a valid Collection' do
|
1135
|
+
before do
|
1136
|
+
@value = @model.all
|
1137
|
+
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1138
|
+
end
|
1132
1139
|
|
1133
|
-
|
1134
|
-
before do
|
1135
|
-
@value = @model.all
|
1136
|
-
@comparison = DataMapper::Query::Conditions::Comparison.new(@slug, @relationship, @value)
|
1140
|
+
it { should be(true) }
|
1137
1141
|
end
|
1138
|
-
|
1139
|
-
it { should be_true }
|
1140
1142
|
end
|
1141
1143
|
end
|
1142
1144
|
end
|
@@ -1246,7 +1248,7 @@ describe DataMapper::Query::Conditions::RegexpComparison do
|
|
1246
1248
|
describe '#inspect' do
|
1247
1249
|
subject { @comparison.inspect }
|
1248
1250
|
|
1249
|
-
it { should == '#<DataMapper::Query::Conditions::RegexpComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:title> @dumped_value=/Title/ @loaded_value=/Title/>' }
|
1251
|
+
it { should == '#<DataMapper::Query::Conditions::RegexpComparison @subject=#<DataMapper::Property::String @model=Blog::Article @name=:title> @dumped_value=/Title/ @loaded_value=/Title/>' }
|
1250
1252
|
end
|
1251
1253
|
|
1252
1254
|
it { should respond_to(:matches?) }
|
@@ -1256,37 +1258,37 @@ describe DataMapper::Query::Conditions::RegexpComparison do
|
|
1256
1258
|
describe 'with a matching Hash' do
|
1257
1259
|
subject { @comparison.matches?(@property.field => 'Title') }
|
1258
1260
|
|
1259
|
-
it { should
|
1261
|
+
it { should be(true) }
|
1260
1262
|
end
|
1261
1263
|
|
1262
1264
|
describe 'with a not matching Hash' do
|
1263
1265
|
subject { @comparison.matches?(@property.field => 'Other') }
|
1264
1266
|
|
1265
|
-
it { should
|
1267
|
+
it { should be(false) }
|
1266
1268
|
end
|
1267
1269
|
|
1268
1270
|
describe 'with a matching Resource' do
|
1269
1271
|
subject { @comparison.matches?(@model.new(@property => 'Title')) }
|
1270
1272
|
|
1271
|
-
it { should
|
1273
|
+
it { should be(true) }
|
1272
1274
|
end
|
1273
1275
|
|
1274
1276
|
describe 'with a not matching Resource' do
|
1275
1277
|
subject { @comparison.matches?(@model.new(@property => 'Other')) }
|
1276
1278
|
|
1277
|
-
it { should
|
1279
|
+
it { should be(false) }
|
1278
1280
|
end
|
1279
1281
|
|
1280
1282
|
describe 'with a not matching nil field' do
|
1281
1283
|
subject { @comparison.matches?(@property.field => nil) }
|
1282
1284
|
|
1283
|
-
it { should
|
1285
|
+
it { should be(false) }
|
1284
1286
|
end
|
1285
1287
|
|
1286
1288
|
describe 'with a not matching nil attribute' do
|
1287
1289
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1288
1290
|
|
1289
|
-
it { should
|
1291
|
+
it { should be(false) }
|
1290
1292
|
end
|
1291
1293
|
end
|
1292
1294
|
end
|
@@ -1296,7 +1298,7 @@ describe DataMapper::Query::Conditions::RegexpComparison do
|
|
1296
1298
|
describe '#relationship?' do
|
1297
1299
|
subject { @comparison.relationship? }
|
1298
1300
|
|
1299
|
-
it { should
|
1301
|
+
it { should be(false) }
|
1300
1302
|
end
|
1301
1303
|
|
1302
1304
|
it { should respond_to(:to_s) }
|
@@ -1328,7 +1330,7 @@ describe DataMapper::Query::Conditions::LikeComparison do
|
|
1328
1330
|
describe '#inspect' do
|
1329
1331
|
subject { @comparison.inspect }
|
1330
1332
|
|
1331
|
-
it { should == '#<DataMapper::Query::Conditions::LikeComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:title> @dumped_value="_it%" @loaded_value="_it%">' }
|
1333
|
+
it { should == '#<DataMapper::Query::Conditions::LikeComparison @subject=#<DataMapper::Property::String @model=Blog::Article @name=:title> @dumped_value="_it%" @loaded_value="_it%">' }
|
1332
1334
|
end
|
1333
1335
|
|
1334
1336
|
it { should respond_to(:matches?) }
|
@@ -1338,37 +1340,37 @@ describe DataMapper::Query::Conditions::LikeComparison do
|
|
1338
1340
|
describe 'with a matching Hash' do
|
1339
1341
|
subject { @comparison.matches?(@property.field => 'Title') }
|
1340
1342
|
|
1341
|
-
it { should
|
1343
|
+
it { should be(true) }
|
1342
1344
|
end
|
1343
1345
|
|
1344
1346
|
describe 'with a not matching Hash' do
|
1345
1347
|
subject { @comparison.matches?(@property.field => 'Other Title') }
|
1346
1348
|
|
1347
|
-
it { should
|
1349
|
+
it { should be(false) }
|
1348
1350
|
end
|
1349
1351
|
|
1350
1352
|
describe 'with a matching Resource' do
|
1351
1353
|
subject { @comparison.matches?(@model.new(@property => 'Title')) }
|
1352
1354
|
|
1353
|
-
it { should
|
1355
|
+
it { should be(true) }
|
1354
1356
|
end
|
1355
1357
|
|
1356
1358
|
describe 'with a not matching Resource' do
|
1357
1359
|
subject { @comparison.matches?(@model.new(@property => 'Other Title')) }
|
1358
1360
|
|
1359
|
-
it { should
|
1361
|
+
it { should be(false) }
|
1360
1362
|
end
|
1361
1363
|
|
1362
1364
|
describe 'with a not matching nil field' do
|
1363
1365
|
subject { @comparison.matches?(@property.field => nil) }
|
1364
1366
|
|
1365
|
-
it { should
|
1367
|
+
it { should be(false) }
|
1366
1368
|
end
|
1367
1369
|
|
1368
1370
|
describe 'with a not matching nil attribute' do
|
1369
1371
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1370
1372
|
|
1371
|
-
it { should
|
1373
|
+
it { should be(false) }
|
1372
1374
|
end
|
1373
1375
|
end
|
1374
1376
|
end
|
@@ -1378,7 +1380,7 @@ describe DataMapper::Query::Conditions::LikeComparison do
|
|
1378
1380
|
describe '#relationship?' do
|
1379
1381
|
subject { @comparison.relationship? }
|
1380
1382
|
|
1381
|
-
it { should
|
1383
|
+
it { should be(false) }
|
1382
1384
|
end
|
1383
1385
|
|
1384
1386
|
it { should respond_to(:to_s) }
|
@@ -1410,7 +1412,7 @@ describe DataMapper::Query::Conditions::GreaterThanComparison do
|
|
1410
1412
|
describe '#inspect' do
|
1411
1413
|
subject { @comparison.inspect }
|
1412
1414
|
|
1413
|
-
it { should == '#<DataMapper::Query::Conditions::GreaterThanComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1415
|
+
it { should == '#<DataMapper::Query::Conditions::GreaterThanComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1414
1416
|
end
|
1415
1417
|
|
1416
1418
|
it { should respond_to(:matches?) }
|
@@ -1420,37 +1422,37 @@ describe DataMapper::Query::Conditions::GreaterThanComparison do
|
|
1420
1422
|
describe 'with a matching Hash' do
|
1421
1423
|
subject { @comparison.matches?(@property.field => 2) }
|
1422
1424
|
|
1423
|
-
it { should
|
1425
|
+
it { should be(true) }
|
1424
1426
|
end
|
1425
1427
|
|
1426
1428
|
describe 'with a not matching Hash' do
|
1427
1429
|
subject { @comparison.matches?(@property.field => 1) }
|
1428
1430
|
|
1429
|
-
it { should
|
1431
|
+
it { should be(false) }
|
1430
1432
|
end
|
1431
1433
|
|
1432
1434
|
describe 'with a matching Resource' do
|
1433
1435
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
1434
1436
|
|
1435
|
-
it { should
|
1437
|
+
it { should be(true) }
|
1436
1438
|
end
|
1437
1439
|
|
1438
1440
|
describe 'with a not matching Resource' do
|
1439
1441
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
1440
1442
|
|
1441
|
-
it { should
|
1443
|
+
it { should be(false) }
|
1442
1444
|
end
|
1443
1445
|
|
1444
1446
|
describe 'with a not matching nil field' do
|
1445
1447
|
subject { @comparison.matches?(@property.field => nil) }
|
1446
1448
|
|
1447
|
-
it { should
|
1449
|
+
it { should be(false) }
|
1448
1450
|
end
|
1449
1451
|
|
1450
1452
|
describe 'with a not matching nil attribute' do
|
1451
1453
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1452
1454
|
|
1453
|
-
it { should
|
1455
|
+
it { should be(false) }
|
1454
1456
|
end
|
1455
1457
|
end
|
1456
1458
|
end
|
@@ -1460,7 +1462,7 @@ describe DataMapper::Query::Conditions::GreaterThanComparison do
|
|
1460
1462
|
describe '#relationship?' do
|
1461
1463
|
subject { @comparison.relationship? }
|
1462
1464
|
|
1463
|
-
it { should
|
1465
|
+
it { should be(false) }
|
1464
1466
|
end
|
1465
1467
|
|
1466
1468
|
it { should respond_to(:to_s) }
|
@@ -1492,7 +1494,7 @@ describe DataMapper::Query::Conditions::LessThanComparison do
|
|
1492
1494
|
describe '#inspect' do
|
1493
1495
|
subject { @comparison.inspect }
|
1494
1496
|
|
1495
|
-
it { should == '#<DataMapper::Query::Conditions::LessThanComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1497
|
+
it { should == '#<DataMapper::Query::Conditions::LessThanComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1496
1498
|
end
|
1497
1499
|
|
1498
1500
|
it { should respond_to(:matches?) }
|
@@ -1502,37 +1504,37 @@ describe DataMapper::Query::Conditions::LessThanComparison do
|
|
1502
1504
|
describe 'with a matching Hash' do
|
1503
1505
|
subject { @comparison.matches?(@property.field => 0) }
|
1504
1506
|
|
1505
|
-
it { should
|
1507
|
+
it { should be(true) }
|
1506
1508
|
end
|
1507
1509
|
|
1508
1510
|
describe 'with a not matching Hash' do
|
1509
1511
|
subject { @comparison.matches?(@property.field => 1) }
|
1510
1512
|
|
1511
|
-
it { should
|
1513
|
+
it { should be(false) }
|
1512
1514
|
end
|
1513
1515
|
|
1514
1516
|
describe 'with a matching Resource' do
|
1515
1517
|
subject { @comparison.matches?(@model.new(@property => 0)) }
|
1516
1518
|
|
1517
|
-
it { should
|
1519
|
+
it { should be(true) }
|
1518
1520
|
end
|
1519
1521
|
|
1520
1522
|
describe 'with a not matching Resource' do
|
1521
1523
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
1522
1524
|
|
1523
|
-
it { should
|
1525
|
+
it { should be(false) }
|
1524
1526
|
end
|
1525
1527
|
|
1526
1528
|
describe 'with a not matching nil field' do
|
1527
1529
|
subject { @comparison.matches?(@property.field => nil) }
|
1528
1530
|
|
1529
|
-
it { should
|
1531
|
+
it { should be(false) }
|
1530
1532
|
end
|
1531
1533
|
|
1532
1534
|
describe 'with a not matching nil attribute' do
|
1533
1535
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1534
1536
|
|
1535
|
-
it { should
|
1537
|
+
it { should be(false) }
|
1536
1538
|
end
|
1537
1539
|
end
|
1538
1540
|
end
|
@@ -1542,7 +1544,7 @@ describe DataMapper::Query::Conditions::LessThanComparison do
|
|
1542
1544
|
describe '#relationship?' do
|
1543
1545
|
subject { @comparison.relationship? }
|
1544
1546
|
|
1545
|
-
it { should
|
1547
|
+
it { should be(false) }
|
1546
1548
|
end
|
1547
1549
|
|
1548
1550
|
it { should respond_to(:to_s) }
|
@@ -1574,7 +1576,7 @@ describe DataMapper::Query::Conditions::GreaterThanOrEqualToComparison do
|
|
1574
1576
|
describe '#inspect' do
|
1575
1577
|
subject { @comparison.inspect }
|
1576
1578
|
|
1577
|
-
it { should == '#<DataMapper::Query::Conditions::GreaterThanOrEqualToComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1579
|
+
it { should == '#<DataMapper::Query::Conditions::GreaterThanOrEqualToComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1578
1580
|
end
|
1579
1581
|
|
1580
1582
|
it { should respond_to(:matches?) }
|
@@ -1584,37 +1586,37 @@ describe DataMapper::Query::Conditions::GreaterThanOrEqualToComparison do
|
|
1584
1586
|
describe 'with a matching Hash' do
|
1585
1587
|
subject { @comparison.matches?(@property.field => 1) }
|
1586
1588
|
|
1587
|
-
it { should
|
1589
|
+
it { should be(true) }
|
1588
1590
|
end
|
1589
1591
|
|
1590
1592
|
describe 'with a not matching Hash' do
|
1591
1593
|
subject { @comparison.matches?(@property.field => 0) }
|
1592
1594
|
|
1593
|
-
it { should
|
1595
|
+
it { should be(false) }
|
1594
1596
|
end
|
1595
1597
|
|
1596
1598
|
describe 'with a matching Resource' do
|
1597
1599
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
1598
1600
|
|
1599
|
-
it { should
|
1601
|
+
it { should be(true) }
|
1600
1602
|
end
|
1601
1603
|
|
1602
1604
|
describe 'with a not matching Resource' do
|
1603
1605
|
subject { @comparison.matches?(@model.new(@property => 0)) }
|
1604
1606
|
|
1605
|
-
it { should
|
1607
|
+
it { should be(false) }
|
1606
1608
|
end
|
1607
1609
|
|
1608
1610
|
describe 'with a not matching nil field' do
|
1609
1611
|
subject { @comparison.matches?(@property.field => nil) }
|
1610
1612
|
|
1611
|
-
it { should
|
1613
|
+
it { should be(false) }
|
1612
1614
|
end
|
1613
1615
|
|
1614
1616
|
describe 'with a not matching nil attribute' do
|
1615
1617
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1616
1618
|
|
1617
|
-
it { should
|
1619
|
+
it { should be(false) }
|
1618
1620
|
end
|
1619
1621
|
end
|
1620
1622
|
end
|
@@ -1624,7 +1626,7 @@ describe DataMapper::Query::Conditions::GreaterThanOrEqualToComparison do
|
|
1624
1626
|
describe '#relationship?' do
|
1625
1627
|
subject { @comparison.relationship? }
|
1626
1628
|
|
1627
|
-
it { should
|
1629
|
+
it { should be(false) }
|
1628
1630
|
end
|
1629
1631
|
|
1630
1632
|
it { should respond_to(:to_s) }
|
@@ -1656,7 +1658,7 @@ describe DataMapper::Query::Conditions::LessThanOrEqualToComparison do
|
|
1656
1658
|
describe '#inspect' do
|
1657
1659
|
subject { @comparison.inspect }
|
1658
1660
|
|
1659
|
-
it { should == '#<DataMapper::Query::Conditions::LessThanOrEqualToComparison @subject=#<DataMapper::Property @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1661
|
+
it { should == '#<DataMapper::Query::Conditions::LessThanOrEqualToComparison @subject=#<DataMapper::Property::Serial @model=Blog::Article @name=:id> @dumped_value=1 @loaded_value=1>' }
|
1660
1662
|
end
|
1661
1663
|
|
1662
1664
|
it { should respond_to(:matches?) }
|
@@ -1666,37 +1668,37 @@ describe DataMapper::Query::Conditions::LessThanOrEqualToComparison do
|
|
1666
1668
|
describe 'with a matching Hash' do
|
1667
1669
|
subject { @comparison.matches?(@property.field => 1) }
|
1668
1670
|
|
1669
|
-
it { should
|
1671
|
+
it { should be(true) }
|
1670
1672
|
end
|
1671
1673
|
|
1672
1674
|
describe 'with a not matching Hash' do
|
1673
1675
|
subject { @comparison.matches?(@property.field => 2) }
|
1674
1676
|
|
1675
|
-
it { should
|
1677
|
+
it { should be(false) }
|
1676
1678
|
end
|
1677
1679
|
|
1678
1680
|
describe 'with a matching Resource' do
|
1679
1681
|
subject { @comparison.matches?(@model.new(@property => 1)) }
|
1680
1682
|
|
1681
|
-
it { should
|
1683
|
+
it { should be(true) }
|
1682
1684
|
end
|
1683
1685
|
|
1684
1686
|
describe 'with a not matching Resource' do
|
1685
1687
|
subject { @comparison.matches?(@model.new(@property => 2)) }
|
1686
1688
|
|
1687
|
-
it { should
|
1689
|
+
it { should be(false) }
|
1688
1690
|
end
|
1689
1691
|
|
1690
1692
|
describe 'with a not matching nil field' do
|
1691
1693
|
subject { @comparison.matches?(@property.field => nil) }
|
1692
1694
|
|
1693
|
-
it { should
|
1695
|
+
it { should be(false) }
|
1694
1696
|
end
|
1695
1697
|
|
1696
1698
|
describe 'with a not matching nil attribute' do
|
1697
1699
|
subject { @comparison.matches?(@model.new(@property => nil)) }
|
1698
1700
|
|
1699
|
-
it { should
|
1701
|
+
it { should be(false) }
|
1700
1702
|
end
|
1701
1703
|
end
|
1702
1704
|
end
|
@@ -1706,7 +1708,7 @@ describe DataMapper::Query::Conditions::LessThanOrEqualToComparison do
|
|
1706
1708
|
describe '#relationship?' do
|
1707
1709
|
subject { @comparison.relationship? }
|
1708
1710
|
|
1709
|
-
it { should
|
1711
|
+
it { should be(false) }
|
1710
1712
|
end
|
1711
1713
|
|
1712
1714
|
it { should respond_to(:to_s) }
|