acts_as_ordered_tree 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -194,7 +194,7 @@ module ActsAsOrderedTree
194
194
  raise ActiveRecord::ActiveRecordError, "index can't be nil" unless index
195
195
 
196
196
  tenacious_transaction do
197
- new_siblings = (node.try(:children) || self.class.roots).
197
+ new_siblings = (node.try(:children) || ordered_tree_scope.roots).
198
198
  reload.
199
199
  lock(true).
200
200
  reject { |root_node| root_node == self }
@@ -1,3 +1,3 @@
1
1
  module ActsAsOrderedTree
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -682,6 +682,23 @@ describe ActsAsOrderedTree, :transactional do
682
682
  expect{ root.move_to_child_with_index child_1, 1 }.to raise_exception ActiveRecord::ActiveRecordError
683
683
  end
684
684
 
685
+ context "with scoped tree" do
686
+ let!(:root1) { create :scoped, :scope_type => 's1' }
687
+ let!(:node1) { create :scoped, :scope_type => 's1', :parent => root1 }
688
+ let!(:root2) { create :scoped, :scope_type => 's2' }
689
+ let!(:node2) { create :scoped, :scope_type => 's2', :parent => root2 }
690
+
691
+ example "move_node1_to_root" do
692
+ node1.should_receive(:move_to_right_of).with(root1)
693
+ node1.move_to_child_with_index nil, 100
694
+ end
695
+
696
+ example "move_node2_to_root" do
697
+ node2.should_receive(:move_to_right_of).with(root2)
698
+ node2.move_to_child_with_index nil, 100
699
+ end
700
+ end
701
+
685
702
  end
686
703
 
687
704
  describe "#insert_at" do
@@ -860,4 +877,4 @@ describe ActsAsOrderedTree, :transactional do
860
877
  end
861
878
  end
862
879
  end
863
- end
880
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_ordered_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-29 00:00:00.000000000 Z
13
+ date: 2013-01-16 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &77952600 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,15 +22,10 @@ dependencies:
22
22
  version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: 3.0.0
25
+ version_requirements: *77952600
31
26
  - !ruby/object:Gem::Dependency
32
27
  name: rake
33
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &77952350 !ruby/object:Gem::Requirement
34
29
  none: false
35
30
  requirements:
36
31
  - - ! '>='
@@ -38,15 +33,10 @@ dependencies:
38
33
  version: 0.9.2
39
34
  type: :development
40
35
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: 0.9.2
36
+ version_requirements: *77952350
47
37
  - !ruby/object:Gem::Dependency
48
38
  name: bundler
49
- requirement: !ruby/object:Gem::Requirement
39
+ requirement: &77952120 !ruby/object:Gem::Requirement
50
40
  none: false
51
41
  requirements:
52
42
  - - ! '>='
@@ -54,15 +44,10 @@ dependencies:
54
44
  version: '1.0'
55
45
  type: :development
56
46
  prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '1.0'
47
+ version_requirements: *77952120
63
48
  - !ruby/object:Gem::Dependency
64
49
  name: rspec
65
- requirement: !ruby/object:Gem::Requirement
50
+ requirement: &77951890 !ruby/object:Gem::Requirement
66
51
  none: false
67
52
  requirements:
68
53
  - - ! '>='
@@ -70,15 +55,10 @@ dependencies:
70
55
  version: '2.11'
71
56
  type: :development
72
57
  prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: '2.11'
58
+ version_requirements: *77951890
79
59
  - !ruby/object:Gem::Dependency
80
60
  name: shoulda-matchers
81
- requirement: !ruby/object:Gem::Requirement
61
+ requirement: &77951660 !ruby/object:Gem::Requirement
82
62
  none: false
83
63
  requirements:
84
64
  - - ! '>='
@@ -86,15 +66,10 @@ dependencies:
86
66
  version: 1.2.0
87
67
  type: :development
88
68
  prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: 1.2.0
69
+ version_requirements: *77951660
95
70
  - !ruby/object:Gem::Dependency
96
71
  name: factory_girl
97
- requirement: !ruby/object:Gem::Requirement
72
+ requirement: &77951430 !ruby/object:Gem::Requirement
98
73
  none: false
99
74
  requirements:
100
75
  - - <
@@ -102,15 +77,10 @@ dependencies:
102
77
  version: '3'
103
78
  type: :development
104
79
  prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - <
109
- - !ruby/object:Gem::Version
110
- version: '3'
80
+ version_requirements: *77951430
111
81
  - !ruby/object:Gem::Dependency
112
82
  name: appraisal
113
- requirement: !ruby/object:Gem::Requirement
83
+ requirement: &77951200 !ruby/object:Gem::Requirement
114
84
  none: false
115
85
  requirements:
116
86
  - - ! '>='
@@ -118,12 +88,7 @@ dependencies:
118
88
  version: 0.4.0
119
89
  type: :development
120
90
  prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: 0.4.0
91
+ version_requirements: *77951200
127
92
  description:
128
93
  email:
129
94
  - amikhailov83@gmail.com
@@ -162,21 +127,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
127
  - - ! '>='
163
128
  - !ruby/object:Gem::Version
164
129
  version: '0'
165
- segments:
166
- - 0
167
- hash: 1615306957006760355
168
130
  required_rubygems_version: !ruby/object:Gem::Requirement
169
131
  none: false
170
132
  requirements:
171
133
  - - ! '>='
172
134
  - !ruby/object:Gem::Version
173
135
  version: '0'
174
- segments:
175
- - 0
176
- hash: 1615306957006760355
177
136
  requirements: []
178
137
  rubyforge_project: acts_as_ordered_tree
179
- rubygems_version: 1.8.24
138
+ rubygems_version: 1.8.17
180
139
  signing_key:
181
140
  specification_version: 3
182
141
  summary: ActiveRecord extension for sorted adjacency lists support