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
@@ -105,19 +105,19 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
105
105
|
|
106
106
|
describe '#==' do
|
107
107
|
describe 'when the other AbstractOperation is equal' do
|
108
|
-
#
|
108
|
+
# artificially modify the object so #== will throw an
|
109
109
|
# exception if the equal? branch is not followed when heckling
|
110
|
-
before { @operation.
|
110
|
+
before { @operation.singleton_class.send(:undef_method, :slug) }
|
111
111
|
|
112
112
|
subject { @operation == @operation }
|
113
113
|
|
114
|
-
it { should
|
114
|
+
it { should be(true) }
|
115
115
|
end
|
116
116
|
|
117
117
|
describe 'when the other AbstractOperation is the same class' do
|
118
118
|
subject { @operation == DataMapper::Query::Conditions::Operation.new(@slug) }
|
119
119
|
|
120
|
-
it { should
|
120
|
+
it { should be(true) }
|
121
121
|
end
|
122
122
|
|
123
123
|
describe 'when the other AbstractOperation is a different class, with the same slug' do
|
@@ -125,7 +125,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
125
125
|
|
126
126
|
subject { @operation == @other }
|
127
127
|
|
128
|
-
it { should
|
128
|
+
it { should be(false) }
|
129
129
|
|
130
130
|
# reset the OtherOperation slug
|
131
131
|
after { @other.class.slug(:other) }
|
@@ -134,7 +134,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
134
134
|
describe 'when the other AbstractOperation is the same class, with different operands' do
|
135
135
|
subject { @operation == DataMapper::Query::Conditions::Operation.new(@slug, @comparison) }
|
136
136
|
|
137
|
-
it { should
|
137
|
+
it { should be(false) }
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -245,31 +245,31 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
245
245
|
|
246
246
|
describe '#eql?' do
|
247
247
|
describe 'when the other AbstractOperation is equal' do
|
248
|
-
#
|
248
|
+
# artificially modify the object so #eql? will throw an
|
249
249
|
# exception if the equal? branch is not followed when heckling
|
250
|
-
before { @operation.
|
250
|
+
before { @operation.singleton_class.send(:undef_method, :slug) }
|
251
251
|
|
252
252
|
subject { @operation.eql?(@operation) }
|
253
253
|
|
254
|
-
it { should
|
254
|
+
it { should be(true) }
|
255
255
|
end
|
256
256
|
|
257
257
|
describe 'when the other AbstractOperation is the same class' do
|
258
258
|
subject { @operation.eql?(DataMapper::Query::Conditions::Operation.new(@slug)) }
|
259
259
|
|
260
|
-
it { should
|
260
|
+
it { should be(true) }
|
261
261
|
end
|
262
262
|
|
263
263
|
describe 'when the other AbstractOperation is a different class' do
|
264
264
|
subject { @operation.eql?(DataMapper::Query::Conditions::Operation.new(:other)) }
|
265
265
|
|
266
|
-
it { should
|
266
|
+
it { should be(false) }
|
267
267
|
end
|
268
268
|
|
269
269
|
describe 'when the other AbstractOperation is the same class, with different operands' do
|
270
270
|
subject { @operation.eql?(DataMapper::Query::Conditions::Operation.new(@slug, @comparison)) }
|
271
271
|
|
272
|
-
it { should
|
272
|
+
it { should be(false) }
|
273
273
|
end
|
274
274
|
|
275
275
|
describe 'when operations contain more than one operand' do
|
@@ -278,7 +278,9 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
278
278
|
@other = @operation.dup
|
279
279
|
end
|
280
280
|
|
281
|
-
|
281
|
+
subject { @operation.eql?(@other) }
|
282
|
+
|
283
|
+
it { should be(true) }
|
282
284
|
end
|
283
285
|
end
|
284
286
|
|
@@ -416,7 +418,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
416
418
|
subject { @operation.valid? }
|
417
419
|
|
418
420
|
describe 'with no operands' do
|
419
|
-
it { should
|
421
|
+
it { should be(false) }
|
420
422
|
end
|
421
423
|
|
422
424
|
describe 'with an operand that responds to #valid?' do
|
@@ -425,7 +427,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
425
427
|
@operation << @comparison
|
426
428
|
end
|
427
429
|
|
428
|
-
it { should
|
430
|
+
it { should be(true) }
|
429
431
|
end
|
430
432
|
|
431
433
|
describe 'and is not valid' do
|
@@ -433,7 +435,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
433
435
|
@operation << @or_operation.dup
|
434
436
|
end
|
435
437
|
|
436
|
-
it { should
|
438
|
+
it { should be(false) }
|
437
439
|
end
|
438
440
|
end
|
439
441
|
|
@@ -442,7 +444,7 @@ shared_examples_for 'DataMapper::Query::Conditions::AbstractOperation' do
|
|
442
444
|
@operation << [ 'raw = 1' ]
|
443
445
|
end
|
444
446
|
|
445
|
-
it { should
|
447
|
+
it { should be(true) }
|
446
448
|
end
|
447
449
|
end
|
448
450
|
end
|
@@ -538,7 +540,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
538
540
|
|
539
541
|
subject { @operation.negated? }
|
540
542
|
|
541
|
-
it { should
|
543
|
+
it { should be(true) }
|
542
544
|
end
|
543
545
|
|
544
546
|
describe 'with a not negated parent' do
|
@@ -548,7 +550,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
548
550
|
|
549
551
|
subject { @operation.negated? }
|
550
552
|
|
551
|
-
it { should
|
553
|
+
it { should be(false) }
|
552
554
|
end
|
553
555
|
|
554
556
|
describe 'after memoizing the negation, and switching parents' do
|
@@ -560,7 +562,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
560
562
|
|
561
563
|
subject { @operation.negated? }
|
562
564
|
|
563
|
-
it { should
|
565
|
+
it { should be(true) }
|
564
566
|
end
|
565
567
|
end
|
566
568
|
|
@@ -575,25 +577,25 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
575
577
|
describe 'with a matching Hash' do
|
576
578
|
subject { @operation.matches?('title' => 'A title', 'id' => 1) }
|
577
579
|
|
578
|
-
it { should
|
580
|
+
it { should be(true) }
|
579
581
|
end
|
580
582
|
|
581
583
|
describe 'with a not matching Hash' do
|
582
584
|
subject { @operation.matches?('title' => 'Not matching', 'id' => 1) }
|
583
585
|
|
584
|
-
it { should
|
586
|
+
it { should be(false) }
|
585
587
|
end
|
586
588
|
|
587
589
|
describe 'with a matching Resource' do
|
588
590
|
subject { @operation.matches?(@model.new(:title => 'A title', :id => 1)) }
|
589
591
|
|
590
|
-
it { should
|
592
|
+
it { should be(true) }
|
591
593
|
end
|
592
594
|
|
593
595
|
describe 'with a not matching Resource' do
|
594
596
|
subject { @operation.matches?(@model.new(:title => 'Not matching', :id => 1)) }
|
595
597
|
|
596
|
-
it { should
|
598
|
+
it { should be(false) }
|
597
599
|
end
|
598
600
|
|
599
601
|
describe 'with a raw condition' do
|
@@ -603,7 +605,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
603
605
|
|
604
606
|
subject { @operation.matches?('title' => 'A title', 'id' => 1) }
|
605
607
|
|
606
|
-
it { should
|
608
|
+
it { should be(true) }
|
607
609
|
end
|
608
610
|
end
|
609
611
|
end
|
@@ -722,7 +724,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
722
724
|
|
723
725
|
subject { @operation.valid? }
|
724
726
|
|
725
|
-
it { should
|
727
|
+
it { should be(false) }
|
726
728
|
end
|
727
729
|
|
728
730
|
describe 'with one invalid operand' do
|
@@ -732,7 +734,7 @@ describe DataMapper::Query::Conditions::AndOperation do
|
|
732
734
|
|
733
735
|
subject { @operation.valid? }
|
734
736
|
|
735
|
-
it { should
|
737
|
+
it { should be(false) }
|
736
738
|
end
|
737
739
|
end
|
738
740
|
end
|
@@ -789,7 +791,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
789
791
|
|
790
792
|
subject { @operation.negated? }
|
791
793
|
|
792
|
-
it { should
|
794
|
+
it { should be(true) }
|
793
795
|
end
|
794
796
|
|
795
797
|
describe 'with a not negated parent' do
|
@@ -799,7 +801,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
799
801
|
|
800
802
|
subject { @operation.negated? }
|
801
803
|
|
802
|
-
it { should
|
804
|
+
it { should be(false) }
|
803
805
|
end
|
804
806
|
|
805
807
|
describe 'after memoizing the negation, and switching parents' do
|
@@ -811,7 +813,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
811
813
|
|
812
814
|
subject { @operation.negated? }
|
813
815
|
|
814
|
-
it { should
|
816
|
+
it { should be(true) }
|
815
817
|
end
|
816
818
|
end
|
817
819
|
|
@@ -826,25 +828,25 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
826
828
|
describe 'with a matching Hash' do
|
827
829
|
subject { @operation.matches?('title' => 'A title', 'id' => 2) }
|
828
830
|
|
829
|
-
it { should
|
831
|
+
it { should be(true) }
|
830
832
|
end
|
831
833
|
|
832
834
|
describe 'with a not matching Hash' do
|
833
835
|
subject { @operation.matches?('title' => 'Not matching', 'id' => 2) }
|
834
836
|
|
835
|
-
it { should
|
837
|
+
it { should be(false) }
|
836
838
|
end
|
837
839
|
|
838
840
|
describe 'with a matching Resource' do
|
839
841
|
subject { @operation.matches?(@model.new(:title => 'A title', :id => 2)) }
|
840
842
|
|
841
|
-
it { should
|
843
|
+
it { should be(true) }
|
842
844
|
end
|
843
845
|
|
844
846
|
describe 'with a not matching Resource' do
|
845
847
|
subject { @operation.matches?(@model.new(:title => 'Not matching', :id => 2)) }
|
846
848
|
|
847
|
-
it { should
|
849
|
+
it { should be(false) }
|
848
850
|
end
|
849
851
|
|
850
852
|
describe 'with a raw condition' do
|
@@ -854,7 +856,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
854
856
|
|
855
857
|
subject { @operation.matches?('title' => 'A title', 'id' => 2) }
|
856
858
|
|
857
|
-
it { should
|
859
|
+
it { should be(true) }
|
858
860
|
end
|
859
861
|
end
|
860
862
|
end
|
@@ -944,7 +946,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
944
946
|
|
945
947
|
subject { @operation.valid? }
|
946
948
|
|
947
|
-
it { should
|
949
|
+
it { should be(true) }
|
948
950
|
end
|
949
951
|
|
950
952
|
describe 'with one invalid operand' do
|
@@ -954,7 +956,7 @@ describe DataMapper::Query::Conditions::OrOperation do
|
|
954
956
|
|
955
957
|
subject { @operation.valid? }
|
956
958
|
|
957
|
-
it { should
|
959
|
+
it { should be(false) }
|
958
960
|
end
|
959
961
|
end
|
960
962
|
end
|
@@ -1017,7 +1019,7 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1017
1019
|
|
1018
1020
|
subject { @operation.negated? }
|
1019
1021
|
|
1020
|
-
it { should
|
1022
|
+
it { should be(false) }
|
1021
1023
|
end
|
1022
1024
|
|
1023
1025
|
describe 'with a not negated parent' do
|
@@ -1027,7 +1029,7 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1027
1029
|
|
1028
1030
|
subject { @operation.negated? }
|
1029
1031
|
|
1030
|
-
it { should
|
1032
|
+
it { should be(true) }
|
1031
1033
|
end
|
1032
1034
|
|
1033
1035
|
describe 'after memoizing the negation, and switching parents' do
|
@@ -1039,7 +1041,7 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1039
1041
|
|
1040
1042
|
subject { @operation.negated? }
|
1041
1043
|
|
1042
|
-
it { should
|
1044
|
+
it { should be(false) }
|
1043
1045
|
end
|
1044
1046
|
end
|
1045
1047
|
|
@@ -1054,25 +1056,25 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1054
1056
|
describe 'with a matching Hash' do
|
1055
1057
|
subject { @operation.matches?('id' => 2) }
|
1056
1058
|
|
1057
|
-
it { should
|
1059
|
+
it { should be(true) }
|
1058
1060
|
end
|
1059
1061
|
|
1060
1062
|
describe 'with a not matching Hash' do
|
1061
1063
|
subject { @operation.matches?('id' => 1) }
|
1062
1064
|
|
1063
|
-
it { should
|
1065
|
+
it { should be(false) }
|
1064
1066
|
end
|
1065
1067
|
|
1066
1068
|
describe 'with a matching Resource' do
|
1067
1069
|
subject { @operation.matches?(@model.new(:id => 2)) }
|
1068
1070
|
|
1069
|
-
it { should
|
1071
|
+
it { should be(true) }
|
1070
1072
|
end
|
1071
1073
|
|
1072
1074
|
describe 'with a not matching Hash' do
|
1073
1075
|
subject { @operation.matches?(@model.new(:id => 1)) }
|
1074
1076
|
|
1075
|
-
it { should
|
1077
|
+
it { should be(false) }
|
1076
1078
|
end
|
1077
1079
|
|
1078
1080
|
describe 'with a raw condition' do
|
@@ -1082,7 +1084,7 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1082
1084
|
|
1083
1085
|
subject { @operation.matches?('id' => 2) }
|
1084
1086
|
|
1085
|
-
it { should
|
1087
|
+
it { should be(true) }
|
1086
1088
|
end
|
1087
1089
|
end
|
1088
1090
|
end
|
@@ -1201,7 +1203,7 @@ describe DataMapper::Query::Conditions::NotOperation do
|
|
1201
1203
|
|
1202
1204
|
subject { @operation.valid? }
|
1203
1205
|
|
1204
|
-
it { should
|
1206
|
+
it { should be(false) }
|
1205
1207
|
end
|
1206
1208
|
end
|
1207
1209
|
end
|
@@ -1242,19 +1244,19 @@ describe DataMapper::Query::Conditions::NullOperation do
|
|
1242
1244
|
describe 'with a Hash' do
|
1243
1245
|
subject { @operation.matches?({}) }
|
1244
1246
|
|
1245
|
-
it { should
|
1247
|
+
it { should be(true) }
|
1246
1248
|
end
|
1247
1249
|
|
1248
1250
|
describe 'with a Resource' do
|
1249
1251
|
subject { @operation.matches?(Blog::Article.new) }
|
1250
1252
|
|
1251
|
-
it { should
|
1253
|
+
it { should be(true) }
|
1252
1254
|
end
|
1253
1255
|
|
1254
1256
|
describe 'with any other Object' do
|
1255
1257
|
subject { @operation.matches?(Object.new) }
|
1256
1258
|
|
1257
|
-
it { should
|
1259
|
+
it { should be(false) }
|
1258
1260
|
end
|
1259
1261
|
end
|
1260
1262
|
|
@@ -1271,7 +1273,7 @@ describe DataMapper::Query::Conditions::NullOperation do
|
|
1271
1273
|
describe '#valid?' do
|
1272
1274
|
subject { @operation.valid? }
|
1273
1275
|
|
1274
|
-
it { should
|
1276
|
+
it { should be(true) }
|
1275
1277
|
end
|
1276
1278
|
|
1277
1279
|
it { should respond_to(:nil?) }
|
@@ -1279,7 +1281,7 @@ describe DataMapper::Query::Conditions::NullOperation do
|
|
1279
1281
|
describe '#nil?' do
|
1280
1282
|
subject { @operation.nil? }
|
1281
1283
|
|
1282
|
-
it { should
|
1284
|
+
it { should be(true) }
|
1283
1285
|
end
|
1284
1286
|
|
1285
1287
|
it { should respond_to(:inspect) }
|
@@ -116,7 +116,7 @@ describe DataMapper::Query::Path do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'should return true' do
|
119
|
-
@return.should
|
119
|
+
@return.should be(true)
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -130,7 +130,7 @@ describe DataMapper::Query::Path do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'should return false' do
|
133
|
-
@return.should
|
133
|
+
@return.should be(false)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -144,7 +144,7 @@ describe DataMapper::Query::Path do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
it 'should return false' do
|
147
|
-
@return.should
|
147
|
+
@return.should be(false)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -156,7 +156,7 @@ describe DataMapper::Query::Path do
|
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'should return false' do
|
159
|
-
@return.should
|
159
|
+
@return.should be(false)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
@@ -168,7 +168,7 @@ describe DataMapper::Query::Path do
|
|
168
168
|
end
|
169
169
|
|
170
170
|
it 'should return false' do
|
171
|
-
@return.should
|
171
|
+
@return.should be(false)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
@@ -180,7 +180,7 @@ describe DataMapper::Query::Path do
|
|
180
180
|
end
|
181
181
|
|
182
182
|
it 'should return true' do
|
183
|
-
@return.should
|
183
|
+
@return.should be(true)
|
184
184
|
end
|
185
185
|
end
|
186
186
|
end
|
@@ -196,7 +196,7 @@ describe DataMapper::Query::Path do
|
|
196
196
|
end
|
197
197
|
|
198
198
|
it 'should return true' do
|
199
|
-
@return.should
|
199
|
+
@return.should be(true)
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -210,7 +210,7 @@ describe DataMapper::Query::Path do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it 'should return false' do
|
213
|
-
@return.should
|
213
|
+
@return.should be(false)
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -222,7 +222,7 @@ describe DataMapper::Query::Path do
|
|
222
222
|
end
|
223
223
|
|
224
224
|
it 'should return false' do
|
225
|
-
@return.should
|
225
|
+
@return.should be(false)
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
@@ -234,7 +234,7 @@ describe DataMapper::Query::Path do
|
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'should return false' do
|
237
|
-
@return.should
|
237
|
+
@return.should be(false)
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
@@ -246,7 +246,7 @@ describe DataMapper::Query::Path do
|
|
246
246
|
end
|
247
247
|
|
248
248
|
it 'should return true' do
|
249
|
-
@return.should
|
249
|
+
@return.should be(true)
|
250
250
|
end
|
251
251
|
end
|
252
252
|
end
|
@@ -278,7 +278,7 @@ describe DataMapper::Query::Path do
|
|
278
278
|
end
|
279
279
|
|
280
280
|
it 'should return a Property' do
|
281
|
-
@path.property.should be_kind_of(DataMapper::Property)
|
281
|
+
@path.property.should be_kind_of(DataMapper::Property::Object)
|
282
282
|
end
|
283
283
|
|
284
284
|
it 'should return expected value' do
|
@@ -308,7 +308,7 @@ describe DataMapper::Query::Path do
|
|
308
308
|
end
|
309
309
|
|
310
310
|
it 'should return true' do
|
311
|
-
@return.should
|
311
|
+
@return.should be(true)
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
@@ -320,7 +320,7 @@ describe DataMapper::Query::Path do
|
|
320
320
|
end
|
321
321
|
|
322
322
|
it 'should return true' do
|
323
|
-
@return.should
|
323
|
+
@return.should be(true)
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
@@ -330,7 +330,7 @@ describe DataMapper::Query::Path do
|
|
330
330
|
end
|
331
331
|
|
332
332
|
it 'should return true' do
|
333
|
-
@return.should
|
333
|
+
@return.should be(true)
|
334
334
|
end
|
335
335
|
end
|
336
336
|
|
@@ -340,7 +340,7 @@ describe DataMapper::Query::Path do
|
|
340
340
|
end
|
341
341
|
|
342
342
|
it 'should return true' do
|
343
|
-
@return.should
|
343
|
+
@return.should be(true)
|
344
344
|
end
|
345
345
|
end
|
346
346
|
|
@@ -350,7 +350,7 @@ describe DataMapper::Query::Path do
|
|
350
350
|
end
|
351
351
|
|
352
352
|
it 'should return false' do
|
353
|
-
@return.should
|
353
|
+
@return.should be(false)
|
354
354
|
end
|
355
355
|
end
|
356
356
|
end
|