ardm-core 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +2 -2
- data/Gemfile +1 -11
- data/ardm-core.gemspec +3 -3
- data/lib/dm-core.rb +2 -2
- data/lib/dm-core/adapters/abstract_adapter.rb +1 -1
- data/lib/dm-core/associations/many_to_one.rb +6 -4
- data/lib/dm-core/collection.rb +1 -0
- data/lib/dm-core/model.rb +3 -2
- data/lib/dm-core/model/property.rb +2 -1
- data/lib/dm-core/property.rb +4 -2
- data/lib/dm-core/query.rb +1 -1
- data/lib/dm-core/resource.rb +8 -1
- data/lib/dm-core/resource/persistence_state/transient.rb +14 -1
- data/lib/dm-core/spec/lib/adapter_helpers.rb +2 -0
- data/lib/dm-core/spec/lib/spec_helper.rb +2 -3
- data/lib/dm-core/spec/setup.rb +4 -2
- data/lib/dm-core/spec/shared/adapter_spec.rb +116 -77
- data/lib/dm-core/spec/shared/resource_spec.rb +5 -1
- data/lib/dm-core/support/mash.rb +1 -1
- data/lib/dm-core/support/naming_conventions.rb +20 -1
- data/lib/dm-core/support/ordered_set.rb +1 -0
- data/lib/dm-core/support/subject_set.rb +1 -0
- data/lib/dm-core/version.rb +1 -1
- data/script/performance.rb +1 -1
- data/script/profile.rb +1 -1
- data/spec/public/associations/many_to_many_spec.rb +2 -2
- data/spec/public/associations/many_to_one_spec.rb +1 -1
- data/spec/public/associations/one_to_many_spec.rb +1 -1
- data/spec/public/associations/one_to_one_spec.rb +2 -2
- data/spec/public/finalize_spec.rb +2 -2
- data/spec/public/model/relationship_spec.rb +19 -19
- data/spec/public/model_spec.rb +1 -1
- data/spec/public/property/discriminator_spec.rb +2 -2
- data/spec/public/property/object_spec.rb +13 -2
- data/spec/public/property_spec.rb +0 -6
- data/spec/public/resource/state_spec.rb +72 -0
- data/spec/public/resource_spec.rb +5 -5
- data/spec/public/shared/association_collection_shared_spec.rb +1 -1
- data/spec/public/shared/collection_shared_spec.rb +24 -24
- data/spec/public/shared/finder_shared_spec.rb +26 -8
- data/spec/spec.opts +1 -3
- data/tasks/ci.rake +1 -1
- data/tasks/spec.rake +0 -21
- data/tasks/yardstick.rake +1 -1
- metadata +26 -19
@@ -72,7 +72,7 @@ describe DataMapper::Resource do
|
|
72
72
|
before :all do
|
73
73
|
user = @user_model.create(:name => 'dbussink', :age => 25, :description => 'Test')
|
74
74
|
|
75
|
-
@user = @user_model.get(*user.key)
|
75
|
+
@user = @user_model.get!(*user.key)
|
76
76
|
end
|
77
77
|
|
78
78
|
it_should_behave_like 'A public Resource'
|
@@ -187,7 +187,7 @@ describe DataMapper::Resource do
|
|
187
187
|
rescue_if @skip do
|
188
188
|
@dkubb = @user.referrer = @user_model.create(:name => 'dkubb', :age => 33)
|
189
189
|
@user.save
|
190
|
-
@user = @user_model.get(*@user.key)
|
190
|
+
@user = @user_model.get!(*@user.key)
|
191
191
|
@user.referrer.should == @dkubb
|
192
192
|
|
193
193
|
@solnic = @user_model.create(:name => 'solnic', :age => 28)
|
@@ -196,7 +196,7 @@ describe DataMapper::Resource do
|
|
196
196
|
|
197
197
|
relationship = @user_model.relationships[:referrer]
|
198
198
|
relationship.child_key.to_a.each_with_index do |k, i|
|
199
|
-
@attributes[k.name] = relationship.parent_key.to_a[i].get(@solnic)
|
199
|
+
@attributes[k.name] = relationship.parent_key.to_a[i].get!(@solnic)
|
200
200
|
end
|
201
201
|
|
202
202
|
@return = @user.__send__(method, @attributes)
|
@@ -212,12 +212,12 @@ describe DataMapper::Resource do
|
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'should persist the changes' do
|
215
|
-
resource = @user_model.get(*@user.key)
|
215
|
+
resource = @user_model.get!(*@user.key)
|
216
216
|
@attributes.each { |key, value| resource.__send__(key).should == value }
|
217
217
|
end
|
218
218
|
|
219
219
|
it 'should return correct parent' do
|
220
|
-
resource = @user_model.get(*@user.key)
|
220
|
+
resource = @user_model.get!(*@user.key)
|
221
221
|
resource.referrer.should == @solnic
|
222
222
|
end
|
223
223
|
end
|
@@ -24,7 +24,7 @@ share_examples_for 'It can transfer a Resource from another association' do
|
|
24
24
|
|
25
25
|
it 'should remove the Resource from the original Collection' do
|
26
26
|
pending do
|
27
|
-
@original.should_not
|
27
|
+
@original.should_not include(@resource)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -324,7 +324,7 @@ share_examples_for 'A public Collection' do
|
|
324
324
|
end
|
325
325
|
|
326
326
|
it 'should remove the Resource from the Collection' do
|
327
|
-
@articles.should_not
|
327
|
+
@articles.should_not include(@resource)
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
@@ -356,7 +356,7 @@ share_examples_for 'A public Collection' do
|
|
356
356
|
end
|
357
357
|
|
358
358
|
it 'should remove the Resource from the Collection' do
|
359
|
-
@articles.should_not
|
359
|
+
@articles.should_not include(@resource)
|
360
360
|
end
|
361
361
|
end
|
362
362
|
|
@@ -390,7 +390,7 @@ share_examples_for 'A public Collection' do
|
|
390
390
|
end
|
391
391
|
|
392
392
|
it 'should remove the Resources from the Collection' do
|
393
|
-
@resources.each { |resource| @articles.should_not
|
393
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
394
394
|
end
|
395
395
|
end
|
396
396
|
|
@@ -458,7 +458,7 @@ share_examples_for 'A public Collection' do
|
|
458
458
|
end
|
459
459
|
|
460
460
|
it 'should not destroy the other Resource' do
|
461
|
-
@article_model.get(*@other.key).should_not be_nil
|
461
|
+
@article_model.get!(*@other.key).should_not be_nil
|
462
462
|
end
|
463
463
|
end
|
464
464
|
end
|
@@ -688,7 +688,7 @@ share_examples_for 'A public Collection' do
|
|
688
688
|
end
|
689
689
|
|
690
690
|
it 'should remove the Resource from the Collection' do
|
691
|
-
@articles.should_not
|
691
|
+
@articles.should_not include(@new)
|
692
692
|
end
|
693
693
|
end
|
694
694
|
|
@@ -707,7 +707,7 @@ share_examples_for 'A public Collection' do
|
|
707
707
|
end
|
708
708
|
|
709
709
|
it 'should remove the Resource from the Collection' do
|
710
|
-
@articles.should_not
|
710
|
+
@articles.should_not include(@new)
|
711
711
|
end
|
712
712
|
end
|
713
713
|
end
|
@@ -754,7 +754,7 @@ share_examples_for 'A public Collection' do
|
|
754
754
|
end
|
755
755
|
|
756
756
|
it 'should remove the Resources from the Collection' do
|
757
|
-
@resources.each { |resource| @articles.should_not
|
757
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
758
758
|
end
|
759
759
|
end
|
760
760
|
|
@@ -1007,7 +1007,7 @@ share_examples_for 'A public Collection' do
|
|
1007
1007
|
end
|
1008
1008
|
|
1009
1009
|
it 'should remove the Resource from the Collection' do
|
1010
|
-
@articles.should_not
|
1010
|
+
@articles.should_not include(@return)
|
1011
1011
|
end
|
1012
1012
|
end
|
1013
1013
|
|
@@ -1027,7 +1027,7 @@ share_examples_for 'A public Collection' do
|
|
1027
1027
|
end
|
1028
1028
|
|
1029
1029
|
it 'should remove the Resource from the Collection' do
|
1030
|
-
@articles.should_not
|
1030
|
+
@articles.should_not include(@article)
|
1031
1031
|
end
|
1032
1032
|
end
|
1033
1033
|
end
|
@@ -1062,7 +1062,7 @@ share_examples_for 'A public Collection' do
|
|
1062
1062
|
end
|
1063
1063
|
|
1064
1064
|
it 'should remove the Resource from the Collection' do
|
1065
|
-
@articles.should_not
|
1065
|
+
@articles.should_not include(@resource)
|
1066
1066
|
end
|
1067
1067
|
end
|
1068
1068
|
|
@@ -1082,7 +1082,7 @@ share_examples_for 'A public Collection' do
|
|
1082
1082
|
end
|
1083
1083
|
|
1084
1084
|
it 'should remove the Resources from the Collection' do
|
1085
|
-
@resources.each { |resource| @articles.should_not
|
1085
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
1086
1086
|
end
|
1087
1087
|
|
1088
1088
|
it 'should scope the Collection' do
|
@@ -1106,7 +1106,7 @@ share_examples_for 'A public Collection' do
|
|
1106
1106
|
end
|
1107
1107
|
|
1108
1108
|
it 'should remove the Resources from the Collection' do
|
1109
|
-
@resources.each { |resource| @articles.should_not
|
1109
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
1110
1110
|
end
|
1111
1111
|
|
1112
1112
|
it 'should scope the Collection' do
|
@@ -1130,7 +1130,7 @@ share_examples_for 'A public Collection' do
|
|
1130
1130
|
end
|
1131
1131
|
|
1132
1132
|
it 'should remove the Resource from the Collection' do
|
1133
|
-
@articles.should_not
|
1133
|
+
@articles.should_not include(@resource)
|
1134
1134
|
end
|
1135
1135
|
end
|
1136
1136
|
|
@@ -1150,7 +1150,7 @@ share_examples_for 'A public Collection' do
|
|
1150
1150
|
end
|
1151
1151
|
|
1152
1152
|
it 'should remove the Resources from the Collection' do
|
1153
|
-
@resources.each { |resource| @articles.should_not
|
1153
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
1154
1154
|
end
|
1155
1155
|
|
1156
1156
|
it 'should scope the Collection' do
|
@@ -1174,7 +1174,7 @@ share_examples_for 'A public Collection' do
|
|
1174
1174
|
end
|
1175
1175
|
|
1176
1176
|
it 'should remove the Resources from the Collection' do
|
1177
|
-
@resources.each { |resource| @articles.should_not
|
1177
|
+
@resources.each { |resource| @articles.should_not include(resource) }
|
1178
1178
|
end
|
1179
1179
|
|
1180
1180
|
it 'should scope the Collection' do
|
@@ -1307,7 +1307,7 @@ share_examples_for 'A public Collection' do
|
|
1307
1307
|
end
|
1308
1308
|
|
1309
1309
|
it 'should include the Resource in the Collection' do
|
1310
|
-
@articles.should
|
1310
|
+
@articles.should include(@resource)
|
1311
1311
|
end
|
1312
1312
|
end
|
1313
1313
|
|
@@ -1335,7 +1335,7 @@ share_examples_for 'A public Collection' do
|
|
1335
1335
|
end
|
1336
1336
|
|
1337
1337
|
it 'should include the Resource in the Collection' do
|
1338
|
-
@articles.should
|
1338
|
+
@articles.should include(@resource)
|
1339
1339
|
end
|
1340
1340
|
end
|
1341
1341
|
|
@@ -1363,7 +1363,7 @@ share_examples_for 'A public Collection' do
|
|
1363
1363
|
end
|
1364
1364
|
|
1365
1365
|
it 'should include the Resource in the Collection' do
|
1366
|
-
@articles.should
|
1366
|
+
@articles.should include(@resource)
|
1367
1367
|
end
|
1368
1368
|
end
|
1369
1369
|
|
@@ -1391,7 +1391,7 @@ share_examples_for 'A public Collection' do
|
|
1391
1391
|
end
|
1392
1392
|
|
1393
1393
|
it 'should include the Resource in the Collection' do
|
1394
|
-
@articles.should
|
1394
|
+
@articles.should include(@resource)
|
1395
1395
|
end
|
1396
1396
|
end
|
1397
1397
|
|
@@ -1419,7 +1419,7 @@ share_examples_for 'A public Collection' do
|
|
1419
1419
|
end
|
1420
1420
|
|
1421
1421
|
it 'should include the Resource in the Collection' do
|
1422
|
-
@articles.should
|
1422
|
+
@articles.should include(@resource)
|
1423
1423
|
end
|
1424
1424
|
end
|
1425
1425
|
|
@@ -1447,7 +1447,7 @@ share_examples_for 'A public Collection' do
|
|
1447
1447
|
end
|
1448
1448
|
|
1449
1449
|
it 'should include the Resource in the Collection' do
|
1450
|
-
@articles.should
|
1450
|
+
@articles.should include(@resource)
|
1451
1451
|
end
|
1452
1452
|
end
|
1453
1453
|
end
|
@@ -1555,7 +1555,7 @@ share_examples_for 'A public Collection' do
|
|
1555
1555
|
end
|
1556
1556
|
|
1557
1557
|
it 'should persist the changes' do
|
1558
|
-
resource = @article_model.get(*@article.key)
|
1558
|
+
resource = @article_model.get!(*@article.key)
|
1559
1559
|
@attributes.each { |key, value| resource.__send__(key).should == value }
|
1560
1560
|
end
|
1561
1561
|
end
|
@@ -1580,7 +1580,7 @@ share_examples_for 'A public Collection' do
|
|
1580
1580
|
end
|
1581
1581
|
|
1582
1582
|
it 'should persist the changes' do
|
1583
|
-
resource = @article_model.get(*@article.key)
|
1583
|
+
resource = @article_model.get!(*@article.key)
|
1584
1584
|
@attributes.each { |key, value| resource.__send__(key).should == value }
|
1585
1585
|
end
|
1586
1586
|
end
|
@@ -1625,7 +1625,7 @@ share_examples_for 'A public Collection' do
|
|
1625
1625
|
end
|
1626
1626
|
|
1627
1627
|
it 'should persist the changes' do
|
1628
|
-
resource = @article_model.get(*@article.key)
|
1628
|
+
resource = @article_model.get!(*@article.key)
|
1629
1629
|
@attributes.each { |key, value| resource.__send__(key).should == value }
|
1630
1630
|
end
|
1631
1631
|
|
@@ -895,19 +895,37 @@ share_examples_for 'Finder Interface' do
|
|
895
895
|
it { @articles.should respond_to(:each) }
|
896
896
|
|
897
897
|
describe '#each' do
|
898
|
-
|
898
|
+
context 'with a block' do
|
899
|
+
subject { @articles.each(&block) }
|
899
900
|
|
900
|
-
|
901
|
-
|
901
|
+
let(:yields) { [] }
|
902
|
+
let(:block) { lambda { |resource| yields << resource } }
|
902
903
|
|
903
|
-
|
904
|
-
|
905
|
-
|
904
|
+
before do
|
905
|
+
@copy = @articles.kind_of?(Class) ? @articles : @articles.dup
|
906
|
+
@copy.to_a
|
907
|
+
end
|
908
|
+
|
909
|
+
it { should equal(@articles) }
|
910
|
+
|
911
|
+
it { method(:subject).should change { yields.dup }.from([]).to(@copy.to_a) }
|
906
912
|
end
|
907
913
|
|
908
|
-
|
914
|
+
context 'without a block' do
|
915
|
+
subject { @articles.each }
|
909
916
|
|
910
|
-
|
917
|
+
let(:yields) { [] }
|
918
|
+
let(:block) { lambda { |resource| yields << resource } }
|
919
|
+
|
920
|
+
before do
|
921
|
+
@copy = @articles.kind_of?(Class) ? @articles : @articles.dup
|
922
|
+
@copy.to_a
|
923
|
+
end
|
924
|
+
|
925
|
+
it { should be_instance_of(to_enum.class) }
|
926
|
+
|
927
|
+
it { expect { subject.each(&block) }.to change { yields.dup }.from([]).to(@copy.to_a) }
|
928
|
+
end
|
911
929
|
end
|
912
930
|
|
913
931
|
it { @articles.should respond_to(:fetch) }
|
data/spec/spec.opts
CHANGED
data/tasks/ci.rake
CHANGED
@@ -1 +1 @@
|
|
1
|
-
task :ci => [ :verify_measurements, '
|
1
|
+
task :ci => [ :verify_measurements, 'spec' ]
|
data/tasks/spec.rake
CHANGED
@@ -14,25 +14,4 @@ rescue LoadError
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
begin
|
18
|
-
require 'rcov'
|
19
|
-
require 'spec/rake/verify_rcov'
|
20
|
-
|
21
|
-
Spec::Rake::SpecTask.new(:rcov) do |rcov|
|
22
|
-
spec_defaults.call(rcov)
|
23
|
-
rcov.rcov = true
|
24
|
-
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
25
|
-
end
|
26
|
-
|
27
|
-
RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
|
28
|
-
rcov.threshold = 100
|
29
|
-
end
|
30
|
-
rescue LoadError
|
31
|
-
%w[ rcov verify_rcov ].each do |name|
|
32
|
-
task name do
|
33
|
-
abort "rcov is not available. In order to run #{name}, you must: gem install rcov"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
17
|
task :default => :spec
|
data/tasks/yardstick.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ardm-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Emde
|
@@ -9,48 +9,54 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '2.3'
|
21
|
+
- - '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.5
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- -
|
28
|
+
- - ~>
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '2.3'
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.3.5
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: rake
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
|
-
- -
|
38
|
+
- - ~>
|
33
39
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0
|
40
|
+
version: '10.0'
|
35
41
|
type: :development
|
36
42
|
prerelease: false
|
37
43
|
version_requirements: !ruby/object:Gem::Requirement
|
38
44
|
requirements:
|
39
|
-
- -
|
45
|
+
- - ~>
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0
|
47
|
+
version: '10.0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: rspec
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
|
-
- -
|
52
|
+
- - ~>
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: '1.3'
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
52
58
|
requirements:
|
53
|
-
- -
|
59
|
+
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
55
61
|
version: '1.3'
|
56
62
|
description: Ardm fork of dm-core
|
@@ -63,11 +69,11 @@ extra_rdoc_files:
|
|
63
69
|
- LICENSE
|
64
70
|
- README.rdoc
|
65
71
|
files:
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
72
|
+
- .autotest
|
73
|
+
- .document
|
74
|
+
- .gitignore
|
75
|
+
- .travis.yml
|
76
|
+
- .yardopts
|
71
77
|
- Gemfile
|
72
78
|
- LICENSE
|
73
79
|
- README.rdoc
|
@@ -202,6 +208,7 @@ files:
|
|
202
208
|
- spec/public/property/text_spec.rb
|
203
209
|
- spec/public/property/time_spec.rb
|
204
210
|
- spec/public/property_spec.rb
|
211
|
+
- spec/public/resource/state_spec.rb
|
205
212
|
- spec/public/resource_spec.rb
|
206
213
|
- spec/public/sel_spec.rb
|
207
214
|
- spec/public/setup_spec.rb
|
@@ -330,17 +337,17 @@ require_paths:
|
|
330
337
|
- lib
|
331
338
|
required_ruby_version: !ruby/object:Gem::Requirement
|
332
339
|
requirements:
|
333
|
-
- -
|
340
|
+
- - '>='
|
334
341
|
- !ruby/object:Gem::Version
|
335
342
|
version: '0'
|
336
343
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
337
344
|
requirements:
|
338
|
-
- -
|
345
|
+
- - '>='
|
339
346
|
- !ruby/object:Gem::Version
|
340
347
|
version: '0'
|
341
348
|
requirements: []
|
342
349
|
rubyforge_project:
|
343
|
-
rubygems_version: 2.
|
350
|
+
rubygems_version: 2.0.14
|
344
351
|
signing_key:
|
345
352
|
specification_version: 4
|
346
353
|
summary: Ardm fork of dm-core
|
@@ -375,6 +382,7 @@ test_files:
|
|
375
382
|
- spec/public/property/text_spec.rb
|
376
383
|
- spec/public/property/time_spec.rb
|
377
384
|
- spec/public/property_spec.rb
|
385
|
+
- spec/public/resource/state_spec.rb
|
378
386
|
- spec/public/resource_spec.rb
|
379
387
|
- spec/public/sel_spec.rb
|
380
388
|
- spec/public/setup_spec.rb
|
@@ -488,4 +496,3 @@ test_files:
|
|
488
496
|
- spec/unit/module_spec.rb
|
489
497
|
- spec/unit/object_spec.rb
|
490
498
|
- spec/unit/try_dup_spec.rb
|
491
|
-
has_rdoc:
|