dm-constraints 1.0.0.rc2 → 1.0.0.rc3

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/Gemfile CHANGED
@@ -71,7 +71,7 @@
71
71
  source 'http://rubygems.org'
72
72
 
73
73
  DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.0.rc2'
74
+ DM_VERSION = '~> 1.0.0.rc3'
75
75
 
76
76
  group :runtime do # Runtime dependencies (as in the gemspec)
77
77
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Dirkjan Bussink
1
+ Copyright (c) 2010 Dirkjan Bussink
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -10,13 +10,13 @@ begin
10
10
  gem.summary = 'DataMapper plugin constraining relationships'
11
11
  gem.description = gem.summary
12
12
  gem.email = 'd.bussink [a] gmail [d] com'
13
- gem.homepage = 'http://github.com/datamapper/dm-more/tree/master/%s' % gem.name
13
+ gem.homepage = 'http://github.com/datamapper/%s' % gem.name
14
14
  gem.authors = [ 'Dirkjan Bussink' ]
15
15
 
16
16
  gem.rubyforge_project = 'datamapper'
17
17
 
18
- gem.add_dependency 'dm-core', '~> 1.0.0.rc2'
19
- gem.add_dependency 'dm-migrations', '~> 1.0.0.rc2'
18
+ gem.add_dependency 'dm-core', '~> 1.0.0.rc3'
19
+ gem.add_dependency 'dm-migrations', '~> 1.0.0.rc3'
20
20
 
21
21
  gem.add_development_dependency 'rspec', '~> 1.3'
22
22
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.rc2
1
+ 1.0.0.rc3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-constraints}
8
- s.version = "1.0.0.rc2"
8
+ s.version = "1.0.0.rc3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dirkjan Bussink"]
12
- s.date = %q{2010-05-19}
12
+ s.date = %q{2010-05-27}
13
13
  s.description = %q{DataMapper plugin constraining relationships}
14
14
  s.email = %q{d.bussink [a] gmail [d] com}
15
15
  s.extra_rdoc_files = [
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  "tasks/yard.rake",
50
50
  "tasks/yardstick.rake"
51
51
  ]
52
- s.homepage = %q{http://github.com/datamapper/dm-more/tree/master/dm-constraints}
52
+ s.homepage = %q{http://github.com/datamapper/dm-constraints}
53
53
  s.rdoc_options = ["--charset=UTF-8"]
54
54
  s.require_paths = ["lib"]
55
55
  s.rubyforge_project = %q{datamapper}
@@ -68,17 +68,17 @@ Gem::Specification.new do |s|
68
68
  s.specification_version = 3
69
69
 
70
70
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
71
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc2"])
72
- s.add_runtime_dependency(%q<dm-migrations>, ["~> 1.0.0.rc2"])
71
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
72
+ s.add_runtime_dependency(%q<dm-migrations>, ["~> 1.0.0.rc3"])
73
73
  s.add_development_dependency(%q<rspec>, ["~> 1.3"])
74
74
  else
75
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc2"])
76
- s.add_dependency(%q<dm-migrations>, ["~> 1.0.0.rc2"])
75
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
76
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0.0.rc3"])
77
77
  s.add_dependency(%q<rspec>, ["~> 1.3"])
78
78
  end
79
79
  else
80
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc2"])
81
- s.add_dependency(%q<dm-migrations>, ["~> 1.0.0.rc2"])
80
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
81
+ s.add_dependency(%q<dm-migrations>, ["~> 1.0.0.rc3"])
82
82
  s.add_dependency(%q<rspec>, ["~> 1.3"])
83
83
  end
84
84
  end
@@ -38,8 +38,8 @@ module DataMapper
38
38
  end
39
39
 
40
40
  def self.include_constraint_api
41
- DataMapper::Repository.adapters.values.each do |adapter|
42
- DataMapper::Adapters.include_constraint_api(ActiveSupport::Inflector.demodulize(adapter.class.name))
41
+ DataMapper::Adapters::AbstractAdapter.descendants.each do |adapter_class|
42
+ DataMapper::Adapters.include_constraint_api(ActiveSupport::Inflector.demodulize(adapter_class.name))
43
43
  end
44
44
  end
45
45
 
@@ -53,24 +53,22 @@ module DataMapper
53
53
  include DataMapper::Constraints::Adapters::AbstractAdapter
54
54
  end
55
55
 
56
- extend Chainable
57
-
58
- class << self
59
-
60
- def include_constraint_api(const_name)
61
- require constraint_extensions(const_name)
62
- if Constraints::Adapters.const_defined?(const_name)
63
- adapter = const_get(const_name)
64
- adapter.send(:include, constraint_module(const_name))
65
- end
66
- rescue LoadError
67
- # do nothing
56
+ def self.include_constraint_api(const_name)
57
+ require constraint_extensions(const_name)
58
+ if Constraints::Adapters.const_defined?(const_name)
59
+ adapter = const_get(const_name)
60
+ adapter.send(:include, constraint_module(const_name))
68
61
  end
62
+ rescue LoadError
63
+ # Silently ignore the fact that no adapter extensions could be required
64
+ # This means that the adapter in use doesn't support constraints
65
+ end
69
66
 
70
- def constraint_module(const_name)
71
- Constraints::Adapters.const_get(const_name)
72
- end
67
+ def self.constraint_module(const_name)
68
+ Constraints::Adapters.const_get(const_name)
69
+ end
73
70
 
71
+ class << self
74
72
  private
75
73
 
76
74
  # @api private
@@ -92,12 +92,12 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
92
92
  end
93
93
 
94
94
  it 'should destroy the parent if there are no children in the association' do
95
- @article.destroy.should be_true
95
+ @article.destroy.should be(true)
96
96
  @article.model.get(*@article.key).should be_nil
97
97
  end
98
98
 
99
99
  it 'the child should be destroyable' do
100
- @revision.destroy.should be_true
100
+ @revision.destroy.should be(true)
101
101
  @revision.model.get(*@revision.key).should be_nil
102
102
  end
103
103
  end
@@ -112,12 +112,12 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
112
112
  end
113
113
 
114
114
  it 'should destroy the parent if there are no children in the association' do
115
- @author.destroy.should be_true
115
+ @author.destroy.should be(true)
116
116
  @author.model.get(*@author.key).should be_nil
117
117
  end
118
118
 
119
119
  it 'should not destroy the parent if there are children in the association' do
120
- @other_author.destroy.should be_false
120
+ @other_author.destroy.should be(false)
121
121
  @other_author.model.get(*@other_author.key).should_not be_nil
122
122
  end
123
123
  end
@@ -152,12 +152,12 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
152
152
  end
153
153
 
154
154
  it 'should not destroy the parent if there are children in the association' do
155
- @article.destroy.should be_false
155
+ @article.destroy.should be(false)
156
156
  @article.model.get(*@article.key).should_not be_nil
157
157
  end
158
158
 
159
159
  it 'the child should be destroyable' do
160
- @revision.destroy.should be_true
160
+ @revision.destroy.should be(true)
161
161
  @revision.model.get(*@revision.key).should be_nil
162
162
  end
163
163
  end
@@ -171,16 +171,16 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
171
171
  end
172
172
 
173
173
  it 'should destroy the parent if there are no children in the association' do
174
- @author.destroy.should be_true
174
+ @author.destroy.should be(true)
175
175
  @author.model.get(*@author.key).should be_nil
176
176
  end
177
177
 
178
178
  it 'should not destroy the parent if there are children in the association' do
179
- @another_author.destroy.should be_false
179
+ @another_author.destroy.should be(false)
180
180
  end
181
181
 
182
182
  it 'the child should be destroyable' do
183
- @comment.destroy.should be_true
183
+ @comment.destroy.should be(true)
184
184
  @comment.model.get(*@comment.key).should be_nil
185
185
  end
186
186
  end
@@ -197,18 +197,18 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
197
197
  end
198
198
 
199
199
  it 'should destroy the parent if there are no children in the association' do
200
- @another_author.destroy.should be_true
200
+ @another_author.destroy.should be(true)
201
201
  @another_author.model.get(*@another_author.key).should be_nil
202
202
  end
203
203
 
204
204
  it 'should not destroy the parent if there are children in the association' do
205
205
  @author.articles.should_not == []
206
- @author.destroy.should be_false
206
+ @author.destroy.should be(false)
207
207
  end
208
208
 
209
209
  it 'the child should be destroyable' do
210
210
  @article.authors.clear
211
- @article.save.should be_true
211
+ @article.save.should be(true)
212
212
  @article.authors.should be_empty
213
213
  end
214
214
  end
@@ -244,18 +244,18 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
244
244
  end
245
245
 
246
246
  it 'should let the parent to be destroyed' do
247
- @article.destroy.should be_true
247
+ @article.destroy.should be(true)
248
248
  @article.model.get(*@article.key).should be_nil
249
249
  end
250
250
 
251
251
  it 'should destroy the children' do
252
252
  revision = @article.revision
253
- @article.destroy.should be_true
253
+ @article.destroy.should be(true)
254
254
  revision.model.get(*revision.key).should be_nil
255
255
  end
256
256
 
257
257
  it 'the child should be destroyable' do
258
- @revision.destroy.should be_true
258
+ @revision.destroy.should be(true)
259
259
  @revision.model.get(*@revision.key).should be_nil
260
260
  end
261
261
  end
@@ -269,17 +269,17 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
269
269
  end
270
270
 
271
271
  it 'should let the parent to be destroyed' do
272
- @author.destroy.should be_true
272
+ @author.destroy.should be(true)
273
273
  @author.model.get(*@author.key).should be_nil
274
274
  end
275
275
 
276
276
  it 'should destroy the children' do
277
- @author.destroy.should be_true
277
+ @author.destroy.should be(true)
278
278
  @author.comments.all? { |comment| comment.should be_new }
279
279
  end
280
280
 
281
281
  it 'the child should be destroyable' do
282
- @comment.destroy.should be_true
282
+ @comment.destroy.should be(true)
283
283
  @comment.model.get(*@comment.key).should be_nil
284
284
  end
285
285
  end
@@ -296,18 +296,18 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
296
296
  end
297
297
 
298
298
  it 'should let the parent to be destroyed' do
299
- @author.destroy.should be_true
299
+ @author.destroy.should be(true)
300
300
  @author.model.get(*@author.key).should be_nil
301
301
  end
302
302
 
303
303
  it 'should destroy the children' do
304
- @author.destroy.should be_true
304
+ @author.destroy.should be(true)
305
305
  @article.model.get(*@article.key).should be_nil
306
306
  @other_article.model.get(*@other_article.key).should be_nil
307
307
  end
308
308
 
309
309
  it 'the child should be destroyable' do
310
- @article.destroy.should be_true
310
+ @article.destroy.should be(true)
311
311
  @article.model.get(*@article.key).should be_nil
312
312
  end
313
313
  end
@@ -343,18 +343,18 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
343
343
  end
344
344
 
345
345
  it 'should let the parent to be destroyed' do
346
- @article.destroy.should be_true
346
+ @article.destroy.should be(true)
347
347
  @article.model.get(*@article.key).should be_nil
348
348
  end
349
349
 
350
350
  it 'should destroy the children' do
351
351
  revision = @article.revision
352
- @article.destroy.should be_true
352
+ @article.destroy.should be(true)
353
353
  revision.model.get(*revision.key).should be_nil
354
354
  end
355
355
 
356
356
  it 'the child should be destroyable' do
357
- @revision.destroy.should be_true
357
+ @revision.destroy.should be(true)
358
358
  @revision.model.get(*@revision.key).should be_nil
359
359
  end
360
360
  end
@@ -368,17 +368,17 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
368
368
  end
369
369
 
370
370
  it 'should let the parent to be destroyed' do
371
- @author.destroy.should be_true
371
+ @author.destroy.should be(true)
372
372
  @author.model.get(*@author.key).should be_nil
373
373
  end
374
374
 
375
375
  it 'should destroy the children' do
376
- @author.destroy.should be_true
376
+ @author.destroy.should be(true)
377
377
  @author.comments.all? { |comment| comment.should be_new }
378
378
  end
379
379
 
380
380
  it 'the child should be destroyable' do
381
- @comment.destroy.should be_true
381
+ @comment.destroy.should be(true)
382
382
  @comment.model.get(*@comment.key).should be_nil
383
383
  end
384
384
  end
@@ -395,7 +395,7 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
395
395
  end
396
396
 
397
397
  it 'should destroy the parent and the children, too' do
398
- @author.destroy.should be_true
398
+ @author.destroy.should be(true)
399
399
  @author.model.get(*@author.key).should be_nil
400
400
 
401
401
  @article.model.get(*@article.key).should be_nil
@@ -403,7 +403,7 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
403
403
  end
404
404
 
405
405
  it 'the child should be destroyable' do
406
- @article.destroy.should be_true
406
+ @article.destroy.should be(true)
407
407
  @article.model.get(*@article.key).should be_nil
408
408
  end
409
409
  end
@@ -440,19 +440,19 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
440
440
  end
441
441
 
442
442
  it 'should let the parent to be destroyed' do
443
- @article.destroy.should be_true
443
+ @article.destroy.should be(true)
444
444
  @article.model.get(*@article.key).should be_nil
445
445
  end
446
446
 
447
447
  it "should set the child's foreign_key id to nil" do
448
448
  revision = @article.revision
449
- @article.destroy.should be_true
449
+ @article.destroy.should be(true)
450
450
  revision.article.should be_nil
451
451
  revision.model.get(*revision.key).article.should be_nil
452
452
  end
453
453
 
454
454
  it 'the child should be destroyable' do
455
- @revision.destroy.should be_true
455
+ @revision.destroy.should be(true)
456
456
  @revision.model.get(*@revision.key).should be_nil
457
457
  end
458
458
  end
@@ -465,20 +465,20 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
465
465
  end
466
466
 
467
467
  it 'should let the parent to be destroyed' do
468
- @author.destroy.should be_true
468
+ @author.destroy.should be(true)
469
469
  @author.model.get(*@author.key).should be_nil
470
470
  end
471
471
 
472
472
  it 'should set the foreign_key ids of children to nil' do
473
- @author.destroy.should be_true
473
+ @author.destroy.should be(true)
474
474
  @author.comments.all? { |comment| comment.author.should be_nil }
475
475
  end
476
476
 
477
477
  it 'the children should be destroyable' do
478
- @comment.destroy.should be_true
478
+ @comment.destroy.should be(true)
479
479
  @comment.model.get(*@comment.key).should be_nil
480
480
 
481
- @other_comment.destroy.should be_true
481
+ @other_comment.destroy.should be(true)
482
482
  @other_comment.model.get(*@other_comment.key).should be_nil
483
483
  end
484
484
  end
@@ -514,17 +514,17 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
514
514
  end
515
515
 
516
516
  it 'should let the parent be destroyed' do
517
- @article.destroy.should be_true
517
+ @article.destroy.should be(true)
518
518
  @article.model.get(*@article.key).should be_nil
519
519
  end
520
520
 
521
521
  it 'should let the children become orphan records' do
522
- @article.destroy.should be_true
522
+ @article.destroy.should be(true)
523
523
  @revision.model.get(*@revision.key).article.should be_nil
524
524
  end
525
525
 
526
526
  it 'the child should be destroyable' do
527
- @revision.destroy.should be_true
527
+ @revision.destroy.should be(true)
528
528
  @revision.model.get(*@revision.key).should be_nil
529
529
  end
530
530
  end
@@ -538,19 +538,19 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
538
538
  end
539
539
 
540
540
  it 'should let the parent to be destroyed' do
541
- @author.destroy.should be_true
541
+ @author.destroy.should be(true)
542
542
  @author.model.get(*@author.key).should be_nil
543
543
  end
544
544
 
545
545
  it 'should let the children become orphan records' do
546
- @author.destroy.should be_true
546
+ @author.destroy.should be(true)
547
547
  @comment.model.get(*@comment.key).author.should be_nil
548
548
  @other_comment.model.get(*@other_comment.key).author.should be_nil
549
549
  end
550
550
 
551
551
  it 'the children should be destroyable' do
552
- @comment.destroy.should be_true
553
- @other_comment.destroy.should be_true
552
+ @comment.destroy.should be(true)
553
+ @other_comment.destroy.should be(true)
554
554
  @other_comment.model.get(*@other_comment.key).should be_nil
555
555
  end
556
556
  end
@@ -567,7 +567,7 @@ describe 'DataMapper::Constraints', "(with #{DataMapper::Spec.adapter_name})" do
567
567
  end
568
568
 
569
569
  it 'the children should be destroyable' do
570
- @article.destroy.should be_true
570
+ @article.destroy.should be(true)
571
571
  @article.model.get(*@article.key).should be_nil
572
572
  end
573
573
  end
@@ -1,14 +1,14 @@
1
1
  shared_examples_for "require 'dm-constraints'" do
2
2
 
3
3
  it "should include the constraint api in the DataMapper namespace" do
4
- DataMapper::Model.respond_to?(:auto_migrate_down_constraints!, true).should be_true
5
- DataMapper::Model.respond_to?(:auto_migrate_up_constraints!, true).should be_true
4
+ DataMapper::Model.respond_to?(:auto_migrate_down_constraints!, true).should be(true)
5
+ DataMapper::Model.respond_to?(:auto_migrate_up_constraints!, true).should be(true)
6
6
  end
7
7
 
8
8
  it "should include the constraint api into the adapter" do
9
- @adapter.respond_to?(:constraint_exists? ).should be_true
10
- @adapter.respond_to?(:create_relationship_constraint ).should be_true
11
- @adapter.respond_to?(:destroy_relationship_constraint).should be_true
9
+ @adapter.respond_to?(:constraint_exists? ).should be(true)
10
+ @adapter.respond_to?(:create_relationship_constraint ).should be(true)
11
+ @adapter.respond_to?(:destroy_relationship_constraint).should be(true)
12
12
  end
13
13
 
14
14
  end
data/spec/rcov.opts CHANGED
@@ -1,4 +1,4 @@
1
- --exclude "spec"
1
+ --exclude "spec,^/"
2
2
  --sort coverage
3
3
  --callsites
4
4
  --xrefs
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,7 @@ Spec::Runner.configure do |config|
12
12
  config.extend(DataMapper::Spec::Helpers)
13
13
 
14
14
  config.before(:each) do
15
+ DataMapper.finalize
15
16
  DataMapper.auto_migrate!
16
17
  end
17
18
 
data/tasks/spec.rake CHANGED
@@ -35,4 +35,7 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
+ task :spec => :check_dependencies
39
+ task :rcov => :check_dependencies
40
+
38
41
  task :default => :spec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-constraints
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940575
4
+ hash: 977940572
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - rc2
11
- version: 1.0.0.rc2
10
+ - rc3
11
+ version: 1.0.0.rc3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Dirkjan Bussink
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-19 00:00:00 -07:00
19
+ date: 2010-05-27 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,13 +27,13 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 977940575
30
+ hash: 977940572
31
31
  segments:
32
32
  - 1
33
33
  - 0
34
34
  - 0
35
- - rc2
36
- version: 1.0.0.rc2
35
+ - rc3
36
+ version: 1.0.0.rc3
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
@@ -44,13 +44,13 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- hash: 977940575
47
+ hash: 977940572
48
48
  segments:
49
49
  - 1
50
50
  - 0
51
51
  - 0
52
- - rc2
53
- version: 1.0.0.rc2
52
+ - rc3
53
+ version: 1.0.0.rc3
54
54
  type: :runtime
55
55
  version_requirements: *id002
56
56
  - !ruby/object:Gem::Dependency
@@ -110,7 +110,7 @@ files:
110
110
  - tasks/yard.rake
111
111
  - tasks/yardstick.rake
112
112
  has_rdoc: true
113
- homepage: http://github.com/datamapper/dm-more/tree/master/dm-constraints
113
+ homepage: http://github.com/datamapper/dm-constraints
114
114
  licenses: []
115
115
 
116
116
  post_install_message: