dm-core 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +29 -0
- data/.document +5 -0
- data/.gitignore +27 -0
- data/LICENSE +20 -0
- data/{README.txt → README.rdoc} +14 -3
- data/Rakefile +23 -22
- data/VERSION +1 -0
- data/dm-core.gemspec +201 -10
- data/lib/dm-core.rb +32 -23
- data/lib/dm-core/adapters.rb +0 -1
- data/lib/dm-core/adapters/data_objects_adapter.rb +230 -151
- data/lib/dm-core/adapters/mysql_adapter.rb +7 -8
- data/lib/dm-core/adapters/oracle_adapter.rb +39 -59
- data/lib/dm-core/adapters/postgres_adapter.rb +0 -1
- data/lib/dm-core/adapters/sqlite3_adapter.rb +5 -0
- data/lib/dm-core/adapters/sqlserver_adapter.rb +114 -0
- data/lib/dm-core/adapters/yaml_adapter.rb +0 -5
- data/lib/dm-core/associations/many_to_many.rb +118 -56
- data/lib/dm-core/associations/many_to_one.rb +48 -21
- data/lib/dm-core/associations/one_to_many.rb +8 -30
- data/lib/dm-core/associations/one_to_one.rb +1 -5
- data/lib/dm-core/associations/relationship.rb +89 -97
- data/lib/dm-core/collection.rb +299 -184
- data/lib/dm-core/core_ext/enumerable.rb +28 -0
- data/lib/dm-core/core_ext/kernel.rb +0 -2
- data/lib/dm-core/migrations.rb +314 -170
- data/lib/dm-core/model.rb +97 -66
- data/lib/dm-core/model/descendant_set.rb +1 -1
- data/lib/dm-core/model/hook.rb +0 -3
- data/lib/dm-core/model/property.rb +7 -10
- data/lib/dm-core/model/relationship.rb +79 -26
- data/lib/dm-core/model/scope.rb +3 -4
- data/lib/dm-core/property.rb +152 -90
- data/lib/dm-core/property_set.rb +18 -37
- data/lib/dm-core/query.rb +452 -153
- data/lib/dm-core/query/conditions/comparison.rb +266 -173
- data/lib/dm-core/query/conditions/operation.rb +499 -57
- data/lib/dm-core/query/direction.rb +0 -3
- data/lib/dm-core/query/operator.rb +0 -4
- data/lib/dm-core/query/path.rb +10 -12
- data/lib/dm-core/query/sort.rb +4 -10
- data/lib/dm-core/repository.rb +10 -6
- data/lib/dm-core/resource.rb +343 -148
- data/lib/dm-core/spec/adapter_shared_spec.rb +17 -1
- data/lib/dm-core/spec/data_objects_adapter_shared_spec.rb +277 -17
- data/lib/dm-core/support/chainable.rb +0 -2
- data/lib/dm-core/support/equalizer.rb +27 -3
- data/lib/dm-core/transaction.rb +75 -75
- data/lib/dm-core/type.rb +19 -5
- data/lib/dm-core/types/discriminator.rb +4 -4
- data/lib/dm-core/types/object.rb +2 -7
- data/lib/dm-core/types/paranoid_boolean.rb +8 -2
- data/lib/dm-core/types/paranoid_datetime.rb +8 -2
- data/lib/dm-core/version.rb +1 -1
- data/script/performance.rb +7 -7
- data/script/profile.rb +6 -6
- data/spec/lib/collection_helpers.rb +2 -2
- data/spec/lib/pending_helpers.rb +22 -3
- data/spec/lib/rspec_immediate_feedback_formatter.rb +1 -0
- data/spec/public/associations/many_to_many_spec.rb +6 -4
- data/spec/public/associations/many_to_one_spec.rb +10 -1
- data/spec/public/associations/many_to_one_with_boolean_cpk_spec.rb +39 -0
- data/spec/public/associations/one_to_many_spec.rb +4 -3
- data/spec/public/associations/one_to_one_spec.rb +19 -1
- data/spec/public/associations/one_to_one_with_boolean_cpk_spec.rb +45 -0
- data/spec/public/collection_spec.rb +4 -3
- data/spec/public/migrations_spec.rb +144 -0
- data/spec/public/model/relationship_spec.rb +115 -55
- data/spec/public/model_spec.rb +13 -13
- data/spec/public/property/object_spec.rb +106 -0
- data/spec/public/property_spec.rb +18 -14
- data/spec/public/resource_spec.rb +10 -1
- data/spec/public/sel_spec.rb +16 -49
- data/spec/public/setup_spec.rb +1 -1
- data/spec/public/shared/association_collection_shared_spec.rb +6 -14
- data/spec/public/shared/collection_finder_shared_spec.rb +267 -0
- data/spec/public/shared/collection_shared_spec.rb +214 -217
- data/spec/public/shared/finder_shared_spec.rb +259 -365
- data/spec/public/shared/resource_shared_spec.rb +524 -248
- data/spec/public/transaction_spec.rb +27 -3
- data/spec/public/types/discriminator_spec.rb +1 -1
- data/spec/rcov.opts +6 -0
- data/spec/semipublic/adapters/sqlserver_adapter_spec.rb +17 -0
- data/spec/semipublic/associations/many_to_one_spec.rb +3 -20
- data/spec/semipublic/associations_spec.rb +2 -2
- data/spec/semipublic/collection_spec.rb +0 -32
- data/spec/semipublic/model_spec.rb +96 -0
- data/spec/semipublic/property_spec.rb +3 -3
- data/spec/semipublic/query/conditions/comparison_spec.rb +1719 -0
- data/spec/semipublic/query/conditions/operation_spec.rb +1292 -0
- data/spec/semipublic/query_spec.rb +1285 -144
- data/spec/semipublic/resource_spec.rb +0 -24
- data/spec/semipublic/shared/resource_shared_spec.rb +103 -38
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +15 -6
- data/tasks/ci.rake +1 -0
- data/tasks/metrics.rake +37 -0
- data/tasks/spec.rake +41 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +99 -29
- data/CONTRIBUTING +0 -51
- data/FAQ +0 -93
- data/History.txt +0 -27
- data/MIT-LICENSE +0 -22
- data/Manifest.txt +0 -121
- data/QUICKLINKS +0 -11
- data/SPECS +0 -35
- data/TODO +0 -1
- data/spec/semipublic/query/conditions_spec.rb +0 -528
- data/tasks/ci.rb +0 -24
- data/tasks/dm.rb +0 -58
- data/tasks/doc.rb +0 -17
- data/tasks/gemspec.rb +0 -23
- data/tasks/hoe.rb +0 -45
- data/tasks/install.rb +0 -18
@@ -10,6 +10,8 @@ share_examples_for 'Finder Interface' do
|
|
10
10
|
@no_join = defined?(DataMapper::Adapters::InMemoryAdapter) && @adapter.kind_of?(DataMapper::Adapters::InMemoryAdapter) ||
|
11
11
|
defined?(DataMapper::Adapters::YamlAdapter) && @adapter.kind_of?(DataMapper::Adapters::YamlAdapter)
|
12
12
|
|
13
|
+
@do_adapter = defined?(DataMapper::Adapters::DataObjectsAdapter) && @adapter.kind_of?(DataMapper::Adapters::DataObjectsAdapter)
|
14
|
+
|
13
15
|
@many_to_many = @articles.kind_of?(DataMapper::Associations::ManyToMany::Collection)
|
14
16
|
|
15
17
|
@skip = @no_join && @many_to_many
|
@@ -42,10 +44,6 @@ share_examples_for 'Finder Interface' do
|
|
42
44
|
it 'should return expected Resource' do
|
43
45
|
@return.should == @copy.entries.send(method, 0)
|
44
46
|
end
|
45
|
-
|
46
|
-
it 'should orphan the Resource' do
|
47
|
-
@resource.collection.should_not equal(@articles)
|
48
|
-
end
|
49
47
|
end
|
50
48
|
|
51
49
|
describe 'with a positive offset and length' do
|
@@ -61,10 +59,6 @@ share_examples_for 'Finder Interface' do
|
|
61
59
|
@return.should == @copy.entries.send(method, 5, 5)
|
62
60
|
end
|
63
61
|
|
64
|
-
it 'should orphan the Resources' do
|
65
|
-
@resources.each { |resource| resource.collection.should_not equal(@articles) }
|
66
|
-
end
|
67
|
-
|
68
62
|
it 'should scope the Collection' do
|
69
63
|
@resources.reload.should == @copy.entries.send(method, 5, 5)
|
70
64
|
end
|
@@ -83,10 +77,6 @@ share_examples_for 'Finder Interface' do
|
|
83
77
|
@return.should == @copy.entries.send(method, 5..10)
|
84
78
|
end
|
85
79
|
|
86
|
-
it 'should orphan the Resources' do
|
87
|
-
@resources.each { |resource| resource.collection.should_not equal(@articles) }
|
88
|
-
end
|
89
|
-
|
90
80
|
it 'should scope the Collection' do
|
91
81
|
@resources.reload.should == @copy.entries.send(method, 5..10)
|
92
82
|
end
|
@@ -106,10 +96,6 @@ share_examples_for 'Finder Interface' do
|
|
106
96
|
it 'should return expected Resource' do
|
107
97
|
@return.should == @copy.entries.send(method, -1)
|
108
98
|
end
|
109
|
-
|
110
|
-
it 'should orphan the Resource' do
|
111
|
-
@resource.collection.should_not equal(@articles)
|
112
|
-
end
|
113
99
|
end
|
114
100
|
|
115
101
|
describe 'with a negative offset and length' do
|
@@ -125,10 +111,6 @@ share_examples_for 'Finder Interface' do
|
|
125
111
|
@return.should == @copy.entries.send(method, -5, 5)
|
126
112
|
end
|
127
113
|
|
128
|
-
it 'should orphan the Resources' do
|
129
|
-
@resources.each { |resource| resource.collection.should_not equal(@articles) }
|
130
|
-
end
|
131
|
-
|
132
114
|
it 'should scope the Collection' do
|
133
115
|
@resources.reload.should == @copy.entries.send(method, -5, 5)
|
134
116
|
end
|
@@ -147,10 +129,6 @@ share_examples_for 'Finder Interface' do
|
|
147
129
|
@return.to_a.should == @copy.entries.send(method, -5..-2)
|
148
130
|
end
|
149
131
|
|
150
|
-
it 'should orphan the Resources' do
|
151
|
-
@resources.each { |resource| resource.collection.should_not equal(@articles) }
|
152
|
-
end
|
153
|
-
|
154
132
|
it 'should scope the Collection' do
|
155
133
|
@resources.reload.should == @copy.entries.send(method, -5..-2)
|
156
134
|
end
|
@@ -322,6 +300,24 @@ share_examples_for 'Finder Interface' do
|
|
322
300
|
end
|
323
301
|
|
324
302
|
describe 'with a query using a m:1 relationship' do
|
303
|
+
describe 'with a Hash' do
|
304
|
+
before :all do
|
305
|
+
@return = @articles.all(:original => @original.attributes)
|
306
|
+
end
|
307
|
+
|
308
|
+
it 'should return a Collection' do
|
309
|
+
@return.should be_kind_of(DataMapper::Collection)
|
310
|
+
end
|
311
|
+
|
312
|
+
it 'should be expected Resources' do
|
313
|
+
@return.should == [ @article ]
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should have a valid query' do
|
317
|
+
@return.query.should be_valid
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
325
321
|
describe 'with a resource' do
|
326
322
|
before :all do
|
327
323
|
@return = @articles.all(:original => @original)
|
@@ -401,6 +397,38 @@ share_examples_for 'Finder Interface' do
|
|
401
397
|
it 'should have a valid query' do
|
402
398
|
@return.query.should be_valid
|
403
399
|
end
|
400
|
+
|
401
|
+
it 'should be equivalent to negated collection query' do
|
402
|
+
pending_if 'Update RDBMS to match ruby behavior', @do_adapter && @articles.kind_of?(DataMapper::Model) do
|
403
|
+
# NOTE: the second query will not match any articles where original_id
|
404
|
+
# is nil, while the in-memory/yaml adapters will. RDBMS will explicitly
|
405
|
+
# filter out NULL matches because we are matching on a non-NULL value,
|
406
|
+
# which is not consistent with how DM/Ruby matching behaves.
|
407
|
+
@return.should == @articles.all(:original.not => @article_model.all)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
describe 'with a negated nil value' do
|
413
|
+
before :all do
|
414
|
+
@return = @articles.all(:original.not => nil)
|
415
|
+
end
|
416
|
+
|
417
|
+
it 'should return a Collection' do
|
418
|
+
@return.should be_kind_of(DataMapper::Collection)
|
419
|
+
end
|
420
|
+
|
421
|
+
it 'should be expected Resources' do
|
422
|
+
@return.should == [ @article ]
|
423
|
+
end
|
424
|
+
|
425
|
+
it 'should have a valid query' do
|
426
|
+
@return.query.should be_valid
|
427
|
+
end
|
428
|
+
|
429
|
+
it 'should be equivalent to collection query' do
|
430
|
+
@return.should == @articles.all(:original => @article_model.all)
|
431
|
+
end
|
404
432
|
end
|
405
433
|
end
|
406
434
|
|
@@ -409,6 +437,24 @@ share_examples_for 'Finder Interface' do
|
|
409
437
|
@new = @articles.create(:content => 'New Article', :original => @article)
|
410
438
|
end
|
411
439
|
|
440
|
+
describe 'with a Hash' do
|
441
|
+
before :all do
|
442
|
+
@return = @articles.all(:previous => @new.attributes)
|
443
|
+
end
|
444
|
+
|
445
|
+
it 'should return a Collection' do
|
446
|
+
@return.should be_kind_of(DataMapper::Collection)
|
447
|
+
end
|
448
|
+
|
449
|
+
it 'should be expected Resources' do
|
450
|
+
@return.should == [ @article ]
|
451
|
+
end
|
452
|
+
|
453
|
+
it 'should have a valid query' do
|
454
|
+
@return.query.should be_valid
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
412
458
|
describe 'with a resource' do
|
413
459
|
before :all do
|
414
460
|
@return = @articles.all(:previous => @new)
|
@@ -474,13 +520,51 @@ share_examples_for 'Finder Interface' do
|
|
474
520
|
@return.should be_kind_of(DataMapper::Collection)
|
475
521
|
end
|
476
522
|
|
477
|
-
|
478
|
-
|
523
|
+
if respond_to?(:model?) && model?
|
524
|
+
it 'should be expected Resources' do
|
525
|
+
@return.should == [ @other, @new ]
|
526
|
+
end
|
527
|
+
else
|
528
|
+
it 'should be expected Resources' do
|
529
|
+
@return.should == [ @new ]
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
it 'should have a valid query' do
|
534
|
+
@return.query.should be_valid
|
535
|
+
end
|
536
|
+
|
537
|
+
it 'should be equivalent to negated collection query' do
|
538
|
+
@return.should == @articles.all(:previous.not => @article_model.all(:original.not => nil))
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
describe 'with a negated nil value' do
|
543
|
+
before :all do
|
544
|
+
@return = @articles.all(:previous.not => nil)
|
545
|
+
end
|
546
|
+
|
547
|
+
it 'should return a Collection' do
|
548
|
+
@return.should be_kind_of(DataMapper::Collection)
|
549
|
+
end
|
550
|
+
|
551
|
+
if respond_to?(:model?) && model?
|
552
|
+
it 'should be expected Resources' do
|
553
|
+
@return.should == [ @original, @article ]
|
554
|
+
end
|
555
|
+
else
|
556
|
+
it 'should be expected Resources' do
|
557
|
+
@return.should == [ @article ]
|
558
|
+
end
|
479
559
|
end
|
480
560
|
|
481
561
|
it 'should have a valid query' do
|
482
562
|
@return.query.should be_valid
|
483
563
|
end
|
564
|
+
|
565
|
+
it 'should be equivalent to collection query' do
|
566
|
+
@return.should == @articles.all(:previous => @article_model.all)
|
567
|
+
end
|
484
568
|
end
|
485
569
|
end
|
486
570
|
|
@@ -489,6 +573,24 @@ share_examples_for 'Finder Interface' do
|
|
489
573
|
@new = @articles.create(:content => 'New Article', :original => @article)
|
490
574
|
end
|
491
575
|
|
576
|
+
describe 'with a Hash' do
|
577
|
+
before :all do
|
578
|
+
@return = @articles.all(:revisions => @new.attributes)
|
579
|
+
end
|
580
|
+
|
581
|
+
it 'should return a Collection' do
|
582
|
+
@return.should be_kind_of(DataMapper::Collection)
|
583
|
+
end
|
584
|
+
|
585
|
+
it 'should be expected Resources' do
|
586
|
+
@return.should == [ @article ]
|
587
|
+
end
|
588
|
+
|
589
|
+
it 'should have a valid query' do
|
590
|
+
@return.query.should be_valid
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
492
594
|
describe 'with a resource' do
|
493
595
|
before :all do
|
494
596
|
@return = @articles.all(:revisions => @new)
|
@@ -554,13 +656,51 @@ share_examples_for 'Finder Interface' do
|
|
554
656
|
@return.should be_kind_of(DataMapper::Collection)
|
555
657
|
end
|
556
658
|
|
557
|
-
|
558
|
-
|
659
|
+
if respond_to?(:model?) && model?
|
660
|
+
it 'should be expected Resources' do
|
661
|
+
@return.should == [ @other, @new ]
|
662
|
+
end
|
663
|
+
else
|
664
|
+
it 'should be expected Resources' do
|
665
|
+
@return.should == [ @new ]
|
666
|
+
end
|
559
667
|
end
|
560
668
|
|
561
669
|
it 'should have a valid query' do
|
562
670
|
@return.query.should be_valid
|
563
671
|
end
|
672
|
+
|
673
|
+
it 'should be equivalent to negated collection query' do
|
674
|
+
@return.should == @articles.all(:revisions.not => @article_model.all(:original.not => nil))
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
describe 'with a negated nil value' do
|
679
|
+
before :all do
|
680
|
+
@return = @articles.all(:revisions.not => nil)
|
681
|
+
end
|
682
|
+
|
683
|
+
it 'should return a Collection' do
|
684
|
+
@return.should be_kind_of(DataMapper::Collection)
|
685
|
+
end
|
686
|
+
|
687
|
+
if respond_to?(:model?) && model?
|
688
|
+
it 'should be expected Resources' do
|
689
|
+
@return.should == [ @original, @article ]
|
690
|
+
end
|
691
|
+
else
|
692
|
+
it 'should be expected Resources' do
|
693
|
+
@return.should == [ @article ]
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
it 'should have a valid query' do
|
698
|
+
@return.query.should be_valid
|
699
|
+
end
|
700
|
+
|
701
|
+
it 'should be equivalent to collection query' do
|
702
|
+
@return.should == @articles.all(:revisions => @article_model.all)
|
703
|
+
end
|
564
704
|
end
|
565
705
|
end
|
566
706
|
|
@@ -569,6 +709,26 @@ share_examples_for 'Finder Interface' do
|
|
569
709
|
@publication = @article.publications.create(:name => 'DataMapper Now')
|
570
710
|
end
|
571
711
|
|
712
|
+
describe 'with a Hash' do
|
713
|
+
before :all do
|
714
|
+
@return = @articles.all(:publications => @publication.attributes)
|
715
|
+
end
|
716
|
+
|
717
|
+
it 'should return a Collection' do
|
718
|
+
@return.should be_kind_of(DataMapper::Collection)
|
719
|
+
end
|
720
|
+
|
721
|
+
it 'should be expected Resources' do
|
722
|
+
pending 'TODO' do
|
723
|
+
@return.should == [ @article ]
|
724
|
+
end
|
725
|
+
end
|
726
|
+
|
727
|
+
it 'should have a valid query' do
|
728
|
+
@return.query.should be_valid
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
572
732
|
describe 'with a resource' do
|
573
733
|
before :all do
|
574
734
|
@return = @articles.all(:publications => @publication)
|
@@ -638,13 +798,43 @@ share_examples_for 'Finder Interface' do
|
|
638
798
|
@return.should be_kind_of(DataMapper::Collection)
|
639
799
|
end
|
640
800
|
|
641
|
-
it 'should be
|
642
|
-
|
801
|
+
it 'should be empty' do
|
802
|
+
pending 'TODO' do
|
803
|
+
@return.should be_empty
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
807
|
+
it 'should have a valid query' do
|
808
|
+
@return.query.should be_valid
|
809
|
+
end
|
810
|
+
|
811
|
+
it 'should be equivalent to negated collection query' do
|
812
|
+
@return.should == @articles.all(:publications.not => @publication_model.all)
|
813
|
+
end
|
814
|
+
end
|
815
|
+
|
816
|
+
describe 'with a negated nil value' do
|
817
|
+
before :all do
|
818
|
+
@return = @articles.all(:publications.not => nil)
|
819
|
+
end
|
820
|
+
|
821
|
+
it 'should return a Collection' do
|
822
|
+
@return.should be_kind_of(DataMapper::Collection)
|
823
|
+
end
|
824
|
+
|
825
|
+
it 'should be expected Resources' do
|
826
|
+
pending 'TODO' do
|
827
|
+
@return.should == [ @article ]
|
828
|
+
end
|
643
829
|
end
|
644
830
|
|
645
831
|
it 'should have a valid query' do
|
646
832
|
@return.query.should be_valid
|
647
833
|
end
|
834
|
+
|
835
|
+
it 'should be equivalent to collection query' do
|
836
|
+
@return.should == @articles.all(:publications => @publication_model.all)
|
837
|
+
end
|
648
838
|
end
|
649
839
|
end
|
650
840
|
end
|
@@ -671,32 +861,8 @@ share_examples_for 'Finder Interface' do
|
|
671
861
|
it 'should return expected Resource' do
|
672
862
|
@resource.should == @copy.entries.at(0)
|
673
863
|
end
|
674
|
-
|
675
|
-
it 'should orphan the Resource' do
|
676
|
-
@resource.collection.should_not equal(@articles)
|
677
|
-
end
|
678
864
|
end
|
679
865
|
|
680
|
-
# describe 'with positive offset', 'after prepending to the collection' do
|
681
|
-
# before :all do
|
682
|
-
# @return = @resource = @articles.unshift(@other).at(0)
|
683
|
-
# end
|
684
|
-
#
|
685
|
-
# should_not_be_a_kicker
|
686
|
-
#
|
687
|
-
# it 'should return a Resource' do
|
688
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
689
|
-
# end
|
690
|
-
#
|
691
|
-
# it 'should return expected Resource' do
|
692
|
-
# @resource.should equal(@other)
|
693
|
-
# end
|
694
|
-
#
|
695
|
-
# it 'should relate the Resource to the Collection' do
|
696
|
-
# @resource.collection.should equal(@articles)
|
697
|
-
# end
|
698
|
-
# end
|
699
|
-
|
700
866
|
describe 'with negative offset' do
|
701
867
|
before :all do
|
702
868
|
@return = @resource = @articles.at(-1)
|
@@ -711,31 +877,7 @@ share_examples_for 'Finder Interface' do
|
|
711
877
|
it 'should return expected Resource' do
|
712
878
|
@resource.should == @copy.entries.at(-1)
|
713
879
|
end
|
714
|
-
|
715
|
-
it 'should orphan the Resource' do
|
716
|
-
@resource.collection.should_not equal(@articles)
|
717
|
-
end
|
718
880
|
end
|
719
|
-
|
720
|
-
# describe 'with negative offset', 'after appending to the collection' do
|
721
|
-
# before :all do
|
722
|
-
# @return = @resource = @articles.push(@other).at(-1)
|
723
|
-
# end
|
724
|
-
#
|
725
|
-
# should_not_be_a_kicker
|
726
|
-
#
|
727
|
-
# it 'should return a Resource' do
|
728
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
729
|
-
# end
|
730
|
-
#
|
731
|
-
# it 'should return expected Resource' do
|
732
|
-
# @resource.should equal(@other)
|
733
|
-
# end
|
734
|
-
#
|
735
|
-
# it 'should relate the Resource to the Collection' do
|
736
|
-
# @resource.collection.should equal(@articles)
|
737
|
-
# end
|
738
|
-
# end
|
739
881
|
end
|
740
882
|
|
741
883
|
it { @articles.should respond_to(:first) }
|
@@ -760,34 +902,8 @@ share_examples_for 'Finder Interface' do
|
|
760
902
|
it 'should be first Resource in the Collection' do
|
761
903
|
@resource.should == @copy.entries.first
|
762
904
|
end
|
763
|
-
|
764
|
-
it 'should orphan the Resource' do
|
765
|
-
@resource.collection.should_not equal(@articles)
|
766
|
-
end
|
767
905
|
end
|
768
906
|
|
769
|
-
# describe 'with no arguments', 'after prepending to the collection' do
|
770
|
-
# before :all do
|
771
|
-
# @return = @resource = @articles.unshift(@other).first
|
772
|
-
# end
|
773
|
-
#
|
774
|
-
# it 'should return a Resource' do
|
775
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
776
|
-
# end
|
777
|
-
#
|
778
|
-
# it 'should return expected Resource' do
|
779
|
-
# @resource.should equal(@other)
|
780
|
-
# end
|
781
|
-
#
|
782
|
-
# it 'should be first Resource in the Collection' do
|
783
|
-
# @resource.should equal(@copy.entries.unshift(@other).first)
|
784
|
-
# end
|
785
|
-
#
|
786
|
-
# it 'should not relate the Resource to the Collection' do
|
787
|
-
# @resource.collection.should_not equal(@articles)
|
788
|
-
# end
|
789
|
-
# end
|
790
|
-
|
791
907
|
describe 'with empty query' do
|
792
908
|
before :all do
|
793
909
|
@return = @resource = @articles.first({})
|
@@ -800,34 +916,8 @@ share_examples_for 'Finder Interface' do
|
|
800
916
|
it 'should be first Resource in the Collection' do
|
801
917
|
@resource.should == @copy.entries.first
|
802
918
|
end
|
803
|
-
|
804
|
-
it 'should orphan the Resource' do
|
805
|
-
@resource.collection.should_not equal(@articles)
|
806
|
-
end
|
807
919
|
end
|
808
920
|
|
809
|
-
# describe 'with empty query', 'after prepending to the collection' do
|
810
|
-
# before :all do
|
811
|
-
# @return = @resource = @articles.unshift(@other).first({})
|
812
|
-
# end
|
813
|
-
#
|
814
|
-
# it 'should return a Resource' do
|
815
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
816
|
-
# end
|
817
|
-
#
|
818
|
-
# it 'should return expected Resource' do
|
819
|
-
# @resource.should equal(@other)
|
820
|
-
# end
|
821
|
-
#
|
822
|
-
# it 'should be first Resource in the Collection' do
|
823
|
-
# @resource.should equal(@copy.entries.unshift(@other).first)
|
824
|
-
# end
|
825
|
-
#
|
826
|
-
# it 'should not relate the Resource to the Collection' do
|
827
|
-
# @resource.collection.should_not equal(@articles)
|
828
|
-
# end
|
829
|
-
# end
|
830
|
-
|
831
921
|
describe 'with a query' do
|
832
922
|
before :all do
|
833
923
|
@return = @resource = @articles.first(:content => 'Sample')
|
@@ -840,10 +930,6 @@ share_examples_for 'Finder Interface' do
|
|
840
930
|
it 'should should be the first Resource in the Collection matching the query' do
|
841
931
|
@resource.should == @article
|
842
932
|
end
|
843
|
-
|
844
|
-
it 'should orphan the Resource' do
|
845
|
-
@resource.collection.should_not equal(@articles)
|
846
|
-
end
|
847
933
|
end
|
848
934
|
|
849
935
|
describe 'with a limit specified' do
|
@@ -858,9 +944,20 @@ share_examples_for 'Finder Interface' do
|
|
858
944
|
it 'should be the first N Resources in the Collection' do
|
859
945
|
@resources.should == @copy.entries.first(1)
|
860
946
|
end
|
947
|
+
end
|
948
|
+
|
949
|
+
describe 'on an empty collection' do
|
950
|
+
before :all do
|
951
|
+
@articles = @articles.all(:id => nil)
|
952
|
+
@return = @articles.first
|
953
|
+
end
|
954
|
+
|
955
|
+
it 'should still be an empty collection' do
|
956
|
+
@articles.should be_empty
|
957
|
+
end
|
861
958
|
|
862
|
-
it 'should
|
863
|
-
@
|
959
|
+
it 'should return nil' do
|
960
|
+
@return.should be_nil
|
864
961
|
end
|
865
962
|
end
|
866
963
|
|
@@ -876,34 +973,8 @@ share_examples_for 'Finder Interface' do
|
|
876
973
|
it 'should be the second Resource in the Collection' do
|
877
974
|
@resource.should == @copy.entries[1]
|
878
975
|
end
|
879
|
-
|
880
|
-
it 'should orphan the Resource' do
|
881
|
-
@resource.collection.should_not equal(@articles)
|
882
|
-
end
|
883
976
|
end
|
884
977
|
|
885
|
-
# describe 'with a limit specified', 'after prepending to the collection' do
|
886
|
-
# before :all do
|
887
|
-
# @return = @resources = @articles.unshift(@other).first(1)
|
888
|
-
# end
|
889
|
-
#
|
890
|
-
# it 'should return a Collection' do
|
891
|
-
# @return.should be_kind_of(DataMapper::Collection)
|
892
|
-
# end
|
893
|
-
#
|
894
|
-
# it 'should be the expected Collection' do
|
895
|
-
# @resources.should == [ @other ]
|
896
|
-
# end
|
897
|
-
#
|
898
|
-
# it 'should be the first N Resources in the Collection' do
|
899
|
-
# @resources.should == @copy.entries.unshift(@other).first(1)
|
900
|
-
# end
|
901
|
-
#
|
902
|
-
# it 'should orphan the Resources' do
|
903
|
-
# @resources.each { |resource| resource.collection.should_not equal(@articles) }
|
904
|
-
# end
|
905
|
-
# end
|
906
|
-
|
907
978
|
describe 'with a limit and query specified' do
|
908
979
|
before :all do
|
909
980
|
@return = @resources = @articles.first(1, :content => 'Sample')
|
@@ -916,10 +987,6 @@ share_examples_for 'Finder Interface' do
|
|
916
987
|
it 'should be the first N Resources in the Collection matching the query' do
|
917
988
|
@resources.should == [ @article ]
|
918
989
|
end
|
919
|
-
|
920
|
-
it 'should orphan the Resources' do
|
921
|
-
@resources.each { |resource| resource.collection.should_not equal(@articles) }
|
922
|
-
end
|
923
990
|
end
|
924
991
|
end
|
925
992
|
|
@@ -942,10 +1009,6 @@ share_examples_for 'Finder Interface' do
|
|
942
1009
|
it 'should be a saved Resource' do
|
943
1010
|
@resource.should be_saved
|
944
1011
|
end
|
945
|
-
|
946
|
-
it 'should orphan the Resource' do
|
947
|
-
@resource.collection.should_not equal(@articles)
|
948
|
-
end
|
949
1012
|
end
|
950
1013
|
|
951
1014
|
describe 'with conditions that do not find an existing Resource' do
|
@@ -967,10 +1030,6 @@ share_examples_for 'Finder Interface' do
|
|
967
1030
|
it 'should be a saved Resource' do
|
968
1031
|
@resource.should be_saved
|
969
1032
|
end
|
970
|
-
|
971
|
-
# it 'should relate the Resource' do
|
972
|
-
# @resource.collection.should equal(@articles)
|
973
|
-
# end
|
974
1033
|
end
|
975
1034
|
end
|
976
1035
|
|
@@ -993,10 +1052,6 @@ share_examples_for 'Finder Interface' do
|
|
993
1052
|
it 'should be a saved Resource' do
|
994
1053
|
@resource.should be_saved
|
995
1054
|
end
|
996
|
-
|
997
|
-
it 'should orphan the Resource' do
|
998
|
-
@resource.collection.should_not equal(@articles)
|
999
|
-
end
|
1000
1055
|
end
|
1001
1056
|
|
1002
1057
|
describe 'with conditions that do not find an existing Resource' do
|
@@ -1018,10 +1073,6 @@ share_examples_for 'Finder Interface' do
|
|
1018
1073
|
it 'should not be a saved Resource' do
|
1019
1074
|
@resource.should be_new
|
1020
1075
|
end
|
1021
|
-
|
1022
|
-
# it 'should relate the Resource' do
|
1023
|
-
# @resource.collection.should equal(@articles)
|
1024
|
-
# end
|
1025
1076
|
end
|
1026
1077
|
end
|
1027
1078
|
|
@@ -1043,10 +1094,6 @@ share_examples_for 'Finder Interface' do
|
|
1043
1094
|
it 'should be matching Resource in the Collection' do
|
1044
1095
|
@resource.should == @article
|
1045
1096
|
end
|
1046
|
-
|
1047
|
-
it 'should orphan the Resource' do
|
1048
|
-
@resource.collection.should_not equal(@articles)
|
1049
|
-
end
|
1050
1097
|
end
|
1051
1098
|
|
1052
1099
|
describe 'with a key not typecast' do
|
@@ -1063,52 +1110,7 @@ share_examples_for 'Finder Interface' do
|
|
1063
1110
|
it 'should be matching Resource in the Collection' do
|
1064
1111
|
@resource.should == @article
|
1065
1112
|
end
|
1066
|
-
|
1067
|
-
it 'should orphan the Resource' do
|
1068
|
-
@resource.collection.should_not equal(@articles)
|
1069
|
-
end
|
1070
|
-
end
|
1071
|
-
|
1072
|
-
# describe 'with a key to a Resource within a Collection using a limit' do
|
1073
|
-
# before :all do
|
1074
|
-
# @articles = @articles.all(:limit => 1)
|
1075
|
-
#
|
1076
|
-
# @return = @resource = @articles.send(method, *@article.key)
|
1077
|
-
# end
|
1078
|
-
#
|
1079
|
-
# it 'should return a Resource' do
|
1080
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
1081
|
-
# end
|
1082
|
-
#
|
1083
|
-
# it 'should be matching Resource in the Collection' do
|
1084
|
-
# @resource.should == @article
|
1085
|
-
# end
|
1086
|
-
#
|
1087
|
-
# it 'should orphan the Resource' do
|
1088
|
-
# @resource.collection.should_not equal(@articles)
|
1089
|
-
# end
|
1090
|
-
# end
|
1091
|
-
#
|
1092
|
-
# describe 'with a key to a Resource within a Collection using an offset' do
|
1093
|
-
# before :all do
|
1094
|
-
# @new = @articles.create(:content => 'New Article') # TODO: freeze @new
|
1095
|
-
# @articles = @articles.all(:offset => 1, :limit => 1)
|
1096
|
-
#
|
1097
|
-
# @return = @resource = @articles.send(method, *@new.key)
|
1098
|
-
# end
|
1099
|
-
#
|
1100
|
-
# it 'should return a Resource' do
|
1101
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
1102
|
-
# end
|
1103
|
-
#
|
1104
|
-
# it 'should be matching Resource in the Collection' do
|
1105
|
-
# @resource.should equal(@new)
|
1106
|
-
# end
|
1107
|
-
#
|
1108
|
-
# it 'should orphan the Resource' do
|
1109
|
-
# @resource.collection.should_not equal(@articles)
|
1110
|
-
# end
|
1111
|
-
# end
|
1113
|
+
end
|
1112
1114
|
|
1113
1115
|
describe 'with a key to a Resource not within the Collection' do
|
1114
1116
|
if method == :get
|
@@ -1151,6 +1153,14 @@ share_examples_for 'Finder Interface' do
|
|
1151
1153
|
end
|
1152
1154
|
end
|
1153
1155
|
end
|
1156
|
+
|
1157
|
+
describe 'with a key that has incorrect number of arguments' do
|
1158
|
+
subject { @articles.send(method) }
|
1159
|
+
|
1160
|
+
it 'should raise an exception' do
|
1161
|
+
method(:subject).should raise_error(ArgumentError, 'The number of arguments for the key is invalid, expected 1 but was 0')
|
1162
|
+
end
|
1163
|
+
end
|
1154
1164
|
end
|
1155
1165
|
end
|
1156
1166
|
|
@@ -1176,34 +1186,8 @@ share_examples_for 'Finder Interface' do
|
|
1176
1186
|
it 'should be last Resource in the Collection' do
|
1177
1187
|
@resource.should == @copy.entries.last
|
1178
1188
|
end
|
1179
|
-
|
1180
|
-
# it 'should not relate the Resource to the Collection' do
|
1181
|
-
# @resource.collection.should_not equal(@articles)
|
1182
|
-
# end
|
1183
1189
|
end
|
1184
1190
|
|
1185
|
-
# describe 'with no arguments', 'after appending to the collection' do
|
1186
|
-
# before :all do
|
1187
|
-
# @return = @resource = @articles.push(@other).last
|
1188
|
-
# end
|
1189
|
-
#
|
1190
|
-
# it 'should return a Resource' do
|
1191
|
-
# @return.should be_kind_of(DataMapper::Resource)
|
1192
|
-
# end
|
1193
|
-
#
|
1194
|
-
# it 'should return expected Resource' do
|
1195
|
-
# @resource.should equal(@other)
|
1196
|
-
# end
|
1197
|
-
#
|
1198
|
-
# it 'should be last Resource in the Collection' do
|
1199
|
-
# @resource.should equal(@copy.entries.push(@other).last)
|
1200
|
-
# end
|
1201
|
-
#
|
1202
|
-
# it 'should not relate the Resource to the Collection' do
|
1203
|
-
# @resource.collection.should_not equal(@articles)
|
1204
|
-
# end
|
1205
|
-
# end
|
1206
|
-
|
1207
1191
|
describe 'with a query' do
|
1208
1192
|
before :all do
|
1209
1193
|
@return = @resource = @articles.last(:content => 'Sample')
|
@@ -1216,10 +1200,6 @@ share_examples_for 'Finder Interface' do
|
|
1216
1200
|
it 'should should be the last Resource in the Collection matching the query' do
|
1217
1201
|
@resource.should == @article
|
1218
1202
|
end
|
1219
|
-
|
1220
|
-
# it 'should not relate the Resource to the Collection' do
|
1221
|
-
# @resource.collection.should_not equal(@articles)
|
1222
|
-
# end
|
1223
1203
|
end
|
1224
1204
|
|
1225
1205
|
describe 'with a limit specified' do
|
@@ -1234,10 +1214,6 @@ share_examples_for 'Finder Interface' do
|
|
1234
1214
|
it 'should be the last N Resources in the Collection' do
|
1235
1215
|
@resources.should == @copy.entries.last(1)
|
1236
1216
|
end
|
1237
|
-
|
1238
|
-
# it 'should orphan the Resources' do
|
1239
|
-
# @resources.each { |resource| resource.collection.should_not equal(@articles) }
|
1240
|
-
# end
|
1241
1217
|
end
|
1242
1218
|
|
1243
1219
|
describe 'with offset specified' do
|
@@ -1252,34 +1228,8 @@ share_examples_for 'Finder Interface' do
|
|
1252
1228
|
it 'should be the second Resource in the Collection' do
|
1253
1229
|
@resource.should == @copy.entries[-2]
|
1254
1230
|
end
|
1255
|
-
|
1256
|
-
it 'should orphan the Resource' do
|
1257
|
-
@resource.collection.should_not equal(@articles)
|
1258
|
-
end
|
1259
1231
|
end
|
1260
1232
|
|
1261
|
-
# describe 'with a limit specified', 'after appending to the collection' do
|
1262
|
-
# before :all do
|
1263
|
-
# @return = @resources = @articles.push(@other).last(1)
|
1264
|
-
# end
|
1265
|
-
#
|
1266
|
-
# it 'should return a Collection' do
|
1267
|
-
# @return.should be_kind_of(DataMapper::Collection)
|
1268
|
-
# end
|
1269
|
-
#
|
1270
|
-
# it 'should be the expected Collection' do
|
1271
|
-
# @resources.should == [ @other ]
|
1272
|
-
# end
|
1273
|
-
#
|
1274
|
-
# it 'should be the last N Resources in the Collection' do
|
1275
|
-
# @resources.should == @copy.entries.push(@other).last(1)
|
1276
|
-
# end
|
1277
|
-
#
|
1278
|
-
# it 'should orphan the Resources' do
|
1279
|
-
# @resources.each { |resource| resource.collection.should_not equal(@articles) }
|
1280
|
-
# end
|
1281
|
-
# end
|
1282
|
-
|
1283
1233
|
describe 'with a limit and query specified' do
|
1284
1234
|
before :all do
|
1285
1235
|
@return = @resources = @articles.last(1, :content => 'Sample')
|
@@ -1292,10 +1242,6 @@ share_examples_for 'Finder Interface' do
|
|
1292
1242
|
it 'should be the last N Resources in the Collection matching the query' do
|
1293
1243
|
@resources.should == [ @article ]
|
1294
1244
|
end
|
1295
|
-
|
1296
|
-
# it 'should orphan the Resources' do
|
1297
|
-
# @resources.each { |resource| resource.collection.should_not equal(@articles) }
|
1298
|
-
# end
|
1299
1245
|
end
|
1300
1246
|
end
|
1301
1247
|
|
@@ -1355,15 +1301,7 @@ share_examples_for 'Finder Interface' do
|
|
1355
1301
|
end
|
1356
1302
|
end
|
1357
1303
|
|
1358
|
-
|
1359
|
-
# and execute in the before :all block
|
1360
|
-
unless loaded
|
1361
|
-
it 'should not be a kicker' do
|
1362
|
-
pending do
|
1363
|
-
@articles.should_not be_loaded
|
1364
|
-
end
|
1365
|
-
end
|
1366
|
-
end
|
1304
|
+
should_not_be_a_kicker
|
1367
1305
|
|
1368
1306
|
it 'should return a Collection' do
|
1369
1307
|
@return.should be_kind_of(DataMapper::Collection)
|
@@ -1380,7 +1318,9 @@ share_examples_for 'Finder Interface' do
|
|
1380
1318
|
|
1381
1319
|
describe 'with a has 1 relationship method' do
|
1382
1320
|
before :all do
|
1383
|
-
|
1321
|
+
# FIXME: create is necessary for m:m so that the intermediary
|
1322
|
+
# is created properly. This does not occur with @new.save
|
1323
|
+
@new = @articles.send(@many_to_many ? :create : :new)
|
1384
1324
|
|
1385
1325
|
@article.previous = @new
|
1386
1326
|
@new.previous = @other
|
@@ -1394,15 +1334,7 @@ share_examples_for 'Finder Interface' do
|
|
1394
1334
|
@return = @articles.previous
|
1395
1335
|
end
|
1396
1336
|
|
1397
|
-
|
1398
|
-
# and execute in the before :all block
|
1399
|
-
unless loaded
|
1400
|
-
it 'should not be a kicker' do
|
1401
|
-
pending do
|
1402
|
-
@articles.should_not be_loaded
|
1403
|
-
end
|
1404
|
-
end
|
1405
|
-
end
|
1337
|
+
should_not_be_a_kicker
|
1406
1338
|
|
1407
1339
|
it 'should return a Collection' do
|
1408
1340
|
@return.should be_kind_of(DataMapper::Collection)
|
@@ -1423,15 +1355,7 @@ share_examples_for 'Finder Interface' do
|
|
1423
1355
|
@return = @articles.previous(:fields => [ :id ])
|
1424
1356
|
end
|
1425
1357
|
|
1426
|
-
|
1427
|
-
# and execute in the before :all block
|
1428
|
-
unless loaded
|
1429
|
-
it 'should not be a kicker' do
|
1430
|
-
pending do
|
1431
|
-
@articles.should_not be_loaded
|
1432
|
-
end
|
1433
|
-
end
|
1434
|
-
end
|
1358
|
+
should_not_be_a_kicker
|
1435
1359
|
|
1436
1360
|
it 'should return a Collection' do
|
1437
1361
|
@return.should be_kind_of(DataMapper::Collection)
|
@@ -1456,7 +1380,9 @@ share_examples_for 'Finder Interface' do
|
|
1456
1380
|
|
1457
1381
|
describe 'with a has n relationship method' do
|
1458
1382
|
before :all do
|
1459
|
-
|
1383
|
+
# FIXME: create is necessary for m:m so that the intermediary
|
1384
|
+
# is created properly. This does not occur with @new.save
|
1385
|
+
@new = @articles.send(@many_to_many ? :create : :new)
|
1460
1386
|
|
1461
1387
|
# associate the article with children
|
1462
1388
|
@article.revisions << @new
|
@@ -1471,15 +1397,7 @@ share_examples_for 'Finder Interface' do
|
|
1471
1397
|
@return = @collection = @articles.revisions
|
1472
1398
|
end
|
1473
1399
|
|
1474
|
-
|
1475
|
-
# and execute in the before :all block
|
1476
|
-
unless loaded
|
1477
|
-
it 'should not be a kicker' do
|
1478
|
-
pending do
|
1479
|
-
@articles.should_not be_loaded
|
1480
|
-
end
|
1481
|
-
end
|
1482
|
-
end
|
1400
|
+
should_not_be_a_kicker
|
1483
1401
|
|
1484
1402
|
it 'should return a Collection' do
|
1485
1403
|
@return.should be_kind_of(DataMapper::Collection)
|
@@ -1499,15 +1417,7 @@ share_examples_for 'Finder Interface' do
|
|
1499
1417
|
@return = @collection = @articles.revisions(:fields => [ :id ])
|
1500
1418
|
end
|
1501
1419
|
|
1502
|
-
|
1503
|
-
# and execute in the before :all block
|
1504
|
-
unless loaded
|
1505
|
-
it 'should not be a kicker' do
|
1506
|
-
pending do
|
1507
|
-
@articles.should_not be_loaded
|
1508
|
-
end
|
1509
|
-
end
|
1510
|
-
end
|
1420
|
+
should_not_be_a_kicker
|
1511
1421
|
|
1512
1422
|
it 'should return a Collection' do
|
1513
1423
|
@return.should be_kind_of(DataMapper::Collection)
|
@@ -1542,28 +1452,20 @@ share_examples_for 'Finder Interface' do
|
|
1542
1452
|
@return = @collection = @articles.publications
|
1543
1453
|
end
|
1544
1454
|
|
1545
|
-
|
1546
|
-
# and execute in the before :all block
|
1547
|
-
unless loaded
|
1548
|
-
it 'should not be a kicker' do
|
1549
|
-
pending do
|
1550
|
-
@articles.should_not be_loaded
|
1551
|
-
end
|
1552
|
-
end
|
1553
|
-
end
|
1455
|
+
should_not_be_a_kicker
|
1554
1456
|
|
1555
1457
|
it 'should return a Collection' do
|
1556
1458
|
@return.should be_kind_of(DataMapper::Collection)
|
1557
1459
|
end
|
1558
1460
|
|
1559
1461
|
it 'should return expected Collection' do
|
1560
|
-
pending_if
|
1462
|
+
pending_if @no_join do
|
1561
1463
|
@collection.should == [ @publication1, @publication2 ]
|
1562
1464
|
end
|
1563
1465
|
end
|
1564
1466
|
|
1565
1467
|
it 'should set the association for each Resource' do
|
1566
|
-
pending_if
|
1468
|
+
pending_if @no_join do
|
1567
1469
|
@articles.map { |resource| resource.publications }.should == [ [ @publication1 ], [ @publication2 ] ]
|
1568
1470
|
end
|
1569
1471
|
end
|
@@ -1574,22 +1476,14 @@ share_examples_for 'Finder Interface' do
|
|
1574
1476
|
@return = @collection = @articles.publications(:fields => [ :id ])
|
1575
1477
|
end
|
1576
1478
|
|
1577
|
-
|
1578
|
-
# and execute in the before :all block
|
1579
|
-
unless loaded
|
1580
|
-
it 'should not be a kicker' do
|
1581
|
-
pending do
|
1582
|
-
@articles.should_not be_loaded
|
1583
|
-
end
|
1584
|
-
end
|
1585
|
-
end
|
1479
|
+
should_not_be_a_kicker
|
1586
1480
|
|
1587
1481
|
it 'should return a Collection' do
|
1588
1482
|
@return.should be_kind_of(DataMapper::Collection)
|
1589
1483
|
end
|
1590
1484
|
|
1591
1485
|
it 'should return expected Collection' do
|
1592
|
-
pending_if
|
1486
|
+
pending_if @no_join do
|
1593
1487
|
@collection.should == [ @publication1, @publication2 ]
|
1594
1488
|
end
|
1595
1489
|
end
|
@@ -1601,7 +1495,7 @@ share_examples_for 'Finder Interface' do
|
|
1601
1495
|
end
|
1602
1496
|
|
1603
1497
|
it 'should set the association for each Resource' do
|
1604
|
-
pending_if
|
1498
|
+
pending_if @no_join do
|
1605
1499
|
@articles.map { |resource| resource.publications }.should == [ [ @publication1 ], [ @publication2 ] ]
|
1606
1500
|
end
|
1607
1501
|
end
|