acts_as_dag 2.0.1 → 2.0.2
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/README.md +1 -1
- data/lib/acts_as_dag/acts_as_dag.rb +1 -1
- data/spec/acts_as_dag_spec.rb +30 -0
- metadata +14 -8
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -346,7 +346,7 @@ module ActsAsDAG
|
|
346
346
|
validate :not_self_referential
|
347
347
|
|
348
348
|
def not_self_referential
|
349
|
-
errors.add(:base, "Self referential links #{self.class} cannot be created.") if parent_id == child_id
|
349
|
+
errors.add(:base, "Self referential links #{self.class} cannot be created.") if parent_id && parent_id == child_id
|
350
350
|
end
|
351
351
|
end
|
352
352
|
|
data/spec/acts_as_dag_spec.rb
CHANGED
@@ -651,6 +651,36 @@ describe 'acts_as_dag' do
|
|
651
651
|
record.reload
|
652
652
|
expect(record.ancestors).to contain_exactly(mom, dad)
|
653
653
|
end
|
654
|
+
|
655
|
+
it "correctly assigns unsaved parents" do
|
656
|
+
unsaved = klass.new
|
657
|
+
record = klass.create!(:parents => [unsaved])
|
658
|
+
expect(record.parents).to contain_exactly(unsaved)
|
659
|
+
end
|
660
|
+
|
661
|
+
it "correctly assigns chains of unsaved parents" do
|
662
|
+
unsaved_ancestor = klass.new
|
663
|
+
unsaved_parent = klass.new(:parents => [unsaved_ancestor])
|
664
|
+
record = klass.create!(:parents => [unsaved_parent])
|
665
|
+
|
666
|
+
expect(record.parents).to contain_exactly(unsaved_parent)
|
667
|
+
expect(unsaved_parent.parents).to contain_exactly(unsaved_ancestor)
|
668
|
+
end
|
669
|
+
|
670
|
+
it "correctly assigns unsaved children" do
|
671
|
+
unsaved = klass.new
|
672
|
+
record = klass.create!(:children => [unsaved])
|
673
|
+
expect(record.children).to contain_exactly(unsaved)
|
674
|
+
end
|
675
|
+
|
676
|
+
it "correctly assigns chains of unsaved children" do
|
677
|
+
unsaved_descendant = klass.new
|
678
|
+
unsaved_child = klass.new(:children => [unsaved_descendant])
|
679
|
+
record = klass.create!(:children => [unsaved_child])
|
680
|
+
|
681
|
+
expect(record.children).to contain_exactly(unsaved_child)
|
682
|
+
expect(unsaved_child.children).to contain_exactly(unsaved_descendant)
|
683
|
+
end
|
654
684
|
end
|
655
685
|
|
656
686
|
describe '::reset_hierarchy' do
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_dag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Nicholas Jakobsen
|
@@ -9,11 +10,12 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activerecord
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - "~>"
|
19
21
|
- !ruby/object:Gem::Version
|
@@ -21,6 +23,7 @@ dependencies:
|
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - "~>"
|
26
29
|
- !ruby/object:Gem::Version
|
@@ -28,6 +31,7 @@ dependencies:
|
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: rspec
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
36
|
- - "~>"
|
33
37
|
- !ruby/object:Gem::Version
|
@@ -35,6 +39,7 @@ dependencies:
|
|
35
39
|
type: :development
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
@@ -45,35 +50,36 @@ executables: []
|
|
45
50
|
extensions: []
|
46
51
|
extra_rdoc_files: []
|
47
52
|
files:
|
48
|
-
- LICENSE
|
49
|
-
- README.md
|
50
|
-
- lib/acts_as_dag.rb
|
51
53
|
- lib/acts_as_dag/acts_as_dag.rb
|
52
54
|
- lib/acts_as_dag/deprecated.rb
|
55
|
+
- lib/acts_as_dag.rb
|
53
56
|
- spec/acts_as_dag_spec.rb
|
54
57
|
- spec/deprecated_spec.rb
|
55
58
|
- spec/spec_helper.rb
|
59
|
+
- LICENSE
|
60
|
+
- README.md
|
56
61
|
homepage: http://github.com/rrn/acts_as_dag
|
57
62
|
licenses: []
|
58
|
-
metadata: {}
|
59
63
|
post_install_message:
|
60
64
|
rdoc_options: []
|
61
65
|
require_paths:
|
62
66
|
- lib
|
63
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
64
69
|
requirements:
|
65
70
|
- - ">="
|
66
71
|
- !ruby/object:Gem::Version
|
67
72
|
version: '0'
|
68
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
69
75
|
requirements:
|
70
76
|
- - ">="
|
71
77
|
- !ruby/object:Gem::Version
|
72
78
|
version: '0'
|
73
79
|
requirements: []
|
74
80
|
rubyforge_project:
|
75
|
-
rubygems_version:
|
81
|
+
rubygems_version: 1.8.25
|
76
82
|
signing_key:
|
77
|
-
specification_version:
|
83
|
+
specification_version: 3
|
78
84
|
summary: Adds directed acyclic graph functionality to ActiveRecord.
|
79
85
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 2ef664650fe43597abf3351e148b8901a5a93fbc
|
4
|
-
data.tar.gz: e0815bacf6b301658b2f09ea4dd3145c77c53ef1
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 64d34f683f65f295c96b7673f47fd070fa5fb14150349ee2c3232bd81dce0523c20777d76f07e7f303e5de3ecd0257724b73672fc5635860726bb78a1b33738f
|
7
|
-
data.tar.gz: 604d62acc24f1d45c81672a9f757218cdd2d05a4c368edd6eece10218e089ace703d235a17e7b8e5a57d07bf0e35ad6aa5d26a5997e5066117ef9fc176cc4603
|