acts_as_ordered_tree 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -209,7 +209,7 @@ describe ActsAsOrderedTree, :transactional do
|
|
209
209
|
it { should be_a ActiveRecord::Relation }
|
210
210
|
it { should have(3).items }
|
211
211
|
its(:first) { should eq root }
|
212
|
-
its(:last) { should eq
|
212
|
+
its(:last) { should eq grandchild }
|
213
213
|
end
|
214
214
|
|
215
215
|
context "child" do
|
@@ -218,7 +218,7 @@ describe ActsAsOrderedTree, :transactional do
|
|
218
218
|
it { should be_a ActiveRecord::Relation }
|
219
219
|
it { should have(2).items }
|
220
220
|
its(:first) { should eq root }
|
221
|
-
its(:last) { should eq
|
221
|
+
its(:last) { should eq child }
|
222
222
|
end
|
223
223
|
|
224
224
|
context "root" do
|
@@ -432,6 +432,7 @@ describe ActsAsOrderedTree, :transactional do
|
|
432
432
|
let!(:child_1) { create :default_with_counter_cache, :parent => root, :name => 'child_1' }
|
433
433
|
let!(:child_2) { create :default_with_counter_cache, :parent => root, :name => 'child_2' }
|
434
434
|
let!(:child_3) { create :default_with_counter_cache, :parent => root, :name => 'child_3' }
|
435
|
+
let!(:child_4) { create :default_with_counter_cache, :parent => child_3, :name => 'child_4' }
|
435
436
|
|
436
437
|
context "initial" do
|
437
438
|
specify { expect([child_1, child_2, child_3]).to be_sorted }
|
@@ -456,6 +457,9 @@ describe ActsAsOrderedTree, :transactional do
|
|
456
457
|
expect{ child_3.save! }.to_not raise_exception
|
457
458
|
expect(child_3.position).to eq 2
|
458
459
|
expect([root, child_3]).to be_sorted
|
460
|
+
|
461
|
+
expect(child_3.reload.level).to eq 0
|
462
|
+
expect(child_4.reload.level).to eq 1
|
459
463
|
end
|
460
464
|
|
461
465
|
example "move_grandchild" do
|
@@ -616,6 +620,23 @@ describe ActsAsOrderedTree, :transactional do
|
|
616
620
|
it { expect([child_1, child_2, child_3, moved_child]).to be_sorted }
|
617
621
|
it { expect{ root.move_to_child_of root }.to raise_exception ActiveRecord::ActiveRecordError }
|
618
622
|
it { expect{ root.move_to_child_of child_1 }.to raise_exception ActiveRecord::ActiveRecordError }
|
623
|
+
|
624
|
+
context "when node with descendants moved and depth is changed" do
|
625
|
+
before { child_3.move_to_child_of child_2 }
|
626
|
+
before { child_4.reload }
|
627
|
+
|
628
|
+
it "changes parent of child_3" do
|
629
|
+
expect(child_3.parent).to eq child_2
|
630
|
+
end
|
631
|
+
|
632
|
+
it "moves to the end of new parents children list" do
|
633
|
+
expect(child_3).to be_last
|
634
|
+
end
|
635
|
+
|
636
|
+
it "changes depth of child_3 descendants" do
|
637
|
+
expect(child_4.level).to eq 3
|
638
|
+
end
|
639
|
+
end
|
619
640
|
end
|
620
641
|
|
621
642
|
describe "#move_to_child_with_index" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: acts_as_ordered_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alexei Mikhailov
|
@@ -10,18 +10,18 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
type: :runtime
|
17
16
|
version_requirements: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - ! '>='
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: 3.0.0
|
22
21
|
none: false
|
23
|
-
name: activerecord
|
24
22
|
prerelease: false
|
23
|
+
name: activerecord
|
24
|
+
type: :runtime
|
25
25
|
requirement: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
@@ -29,15 +29,15 @@ dependencies:
|
|
29
29
|
version: 3.0.0
|
30
30
|
none: false
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
type: :development
|
33
32
|
version_requirements: !ruby/object:Gem::Requirement
|
34
33
|
requirements:
|
35
34
|
- - ! '>='
|
36
35
|
- !ruby/object:Gem::Version
|
37
36
|
version: 0.9.2
|
38
37
|
none: false
|
39
|
-
name: rake
|
40
38
|
prerelease: false
|
39
|
+
name: rake
|
40
|
+
type: :development
|
41
41
|
requirement: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,15 +45,15 @@ dependencies:
|
|
45
45
|
version: 0.9.2
|
46
46
|
none: false
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
type: :development
|
49
48
|
version_requirements: !ruby/object:Gem::Requirement
|
50
49
|
requirements:
|
51
50
|
- - ! '>='
|
52
51
|
- !ruby/object:Gem::Version
|
53
52
|
version: '1.0'
|
54
53
|
none: false
|
55
|
-
name: bundler
|
56
54
|
prerelease: false
|
55
|
+
name: bundler
|
56
|
+
type: :development
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
@@ -61,15 +61,15 @@ dependencies:
|
|
61
61
|
version: '1.0'
|
62
62
|
none: false
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
-
type: :development
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
66
|
- - ! '>='
|
68
67
|
- !ruby/object:Gem::Version
|
69
68
|
version: '2.11'
|
70
69
|
none: false
|
71
|
-
name: rspec
|
72
70
|
prerelease: false
|
71
|
+
name: rspec
|
72
|
+
type: :development
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,15 +77,15 @@ dependencies:
|
|
77
77
|
version: '2.11'
|
78
78
|
none: false
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
type: :development
|
81
80
|
version_requirements: !ruby/object:Gem::Requirement
|
82
81
|
requirements:
|
83
82
|
- - ! '>='
|
84
83
|
- !ruby/object:Gem::Version
|
85
84
|
version: 1.2.0
|
86
85
|
none: false
|
87
|
-
name: shoulda-matchers
|
88
86
|
prerelease: false
|
87
|
+
name: shoulda-matchers
|
88
|
+
type: :development
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
@@ -93,15 +93,15 @@ dependencies:
|
|
93
93
|
version: 1.2.0
|
94
94
|
none: false
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
type: :development
|
97
96
|
version_requirements: !ruby/object:Gem::Requirement
|
98
97
|
requirements:
|
99
98
|
- - <
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '3'
|
102
101
|
none: false
|
103
|
-
name: factory_girl
|
104
102
|
prerelease: false
|
103
|
+
name: factory_girl
|
104
|
+
type: :development
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - <
|
@@ -109,15 +109,15 @@ dependencies:
|
|
109
109
|
version: '3'
|
110
110
|
none: false
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
type: :development
|
113
112
|
version_requirements: !ruby/object:Gem::Requirement
|
114
113
|
requirements:
|
115
114
|
- - ! '>='
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: 0.4.0
|
118
117
|
none: false
|
119
|
-
name: appraisal
|
120
118
|
prerelease: false
|
119
|
+
name: appraisal
|
120
|
+
type: :development
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - ! '>='
|
@@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
segments:
|
164
164
|
- 0
|
165
|
-
hash:
|
165
|
+
hash: 277439329
|
166
166
|
version: '0'
|
167
167
|
none: false
|
168
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -171,12 +171,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
segments:
|
173
173
|
- 0
|
174
|
-
hash:
|
174
|
+
hash: 277439329
|
175
175
|
version: '0'
|
176
176
|
none: false
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project: acts_as_ordered_tree
|
179
|
-
rubygems_version: 1.8.
|
179
|
+
rubygems_version: 1.8.25
|
180
180
|
signing_key:
|
181
181
|
specification_version: 3
|
182
182
|
summary: ActiveRecord extension for sorted adjacency lists support
|