closure_tree 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ describe "empty db" do
40
40
  end
41
41
 
42
42
  it "should create all Users" do
43
- User.all.should =~ [@root, @mid, @leaf]
43
+ User.all.to_a.should =~ [@root, @mid, @leaf]
44
44
  end
45
45
 
46
46
  it "should return a root and leaf without middle User" do
@@ -65,11 +65,11 @@ describe "empty db" do
65
65
  end
66
66
 
67
67
  def assert_mid_and_leaf_remain
68
- ReferralHierarchy.find_all_by_ancestor_id(@root_id).should be_empty
69
- ReferralHierarchy.find_all_by_descendant_id(@root_id).should be_empty
68
+ ReferralHierarchy.where(:ancestor_id => @root_id).should be_empty
69
+ ReferralHierarchy.where(:descendant_id => @root_id).should be_empty
70
70
  @mid.ancestry_path.should == %w{matt@t.co}
71
71
  @leaf.ancestry_path.should == %w{matt@t.co james@t.co}
72
- @mid.self_and_descendants.should =~ [@mid, @leaf]
72
+ @mid.self_and_descendants.to_a.should =~ [@mid, @leaf]
73
73
  User.roots.should == [@mid]
74
74
  User.leaves.should == [@leaf]
75
75
  end
@@ -110,8 +110,8 @@ describe "empty db" do
110
110
  c2.children << d
111
111
 
112
112
  a.save
113
- User.roots.should == [a]
114
- User.leaves.should =~ [b1, c1, d]
113
+ User.roots.to_a.should == [a]
114
+ User.leaves.to_a.should =~ [b1, c1, d]
115
115
  d.ancestry_path.should == %w(a b2 c2 d)
116
116
  end
117
117
 
@@ -122,7 +122,7 @@ describe "empty db" do
122
122
  b2 = a.children.create(:email => "b2")
123
123
  b3 = a.children.create(:email => "b3")
124
124
  a.siblings.should be_empty
125
- b1.siblings.should =~ [b2, b3]
125
+ b1.siblings.to_a.should =~ [b2, b3]
126
126
  end
127
127
 
128
128
  context "when a user is not yet saved" do
@@ -133,7 +133,7 @@ describe "empty db" do
133
133
  b2 = a.children.create(:email => "b2")
134
134
  b3 = a.children.create(:email => "b3")
135
135
  a.siblings.should be_empty
136
- b1.siblings.should =~ [b2, b3]
136
+ b1.siblings.to_a.should =~ [b2, b3]
137
137
  end
138
138
  end
139
139
 
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+ require 'tag_examples'
3
+
4
+ describe UUIDTag do
5
+ it_behaves_like "Tag (without fixtures)"
6
+ end unless ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 1
metadata CHANGED
@@ -1,190 +1,177 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: closure_tree
3
- version: !ruby/object:Gem::Version
4
- version: 4.0.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 59
5
+ prerelease:
6
+ segments:
7
+ - 4
8
+ - 1
9
+ - 0
10
+ version: 4.1.0
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Matthew McEachen
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2013-05-19 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activerecord
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ! '>='
18
- - !ruby/object:Gem::Version
17
+
18
+ date: 2013-06-02 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 7
28
+ segments:
29
+ - 3
30
+ - 0
31
+ - 0
19
32
  version: 3.0.0
20
33
  type: :runtime
34
+ name: activerecord
35
+ version_requirements: *id001
21
36
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ! '>='
25
- - !ruby/object:Gem::Version
26
- version: 3.0.0
27
- - !ruby/object:Gem::Dependency
28
- name: with_advisory_lock
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
37
+ - !ruby/object:Gem::Dependency
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 19
44
+ segments:
45
+ - 0
46
+ - 0
47
+ - 6
33
48
  version: 0.0.6
34
49
  type: :runtime
50
+ name: with_advisory_lock
51
+ version_requirements: *id002
35
52
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: 0.0.6
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
48
63
  type: :development
64
+ name: rake
65
+ version_requirements: *id003
49
66
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
62
77
  type: :development
78
+ name: yard
79
+ version_requirements: *id004
63
80
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
76
91
  type: :development
92
+ name: rspec
93
+ version_requirements: *id005
77
94
  prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rails
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
90
105
  type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ! '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
106
  name: rspec-rails
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ! '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: mysql2
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
107
+ version_requirements: *id006
119
108
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ! '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: pg
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
109
+ - !ruby/object:Gem::Dependency
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
132
119
  type: :development
120
+ name: mysql2
121
+ version_requirements: *id007
133
122
  prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ! '>='
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: sqlite3
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ! '>='
144
- - !ruby/object:Gem::Version
145
- version: '0'
123
+ - !ruby/object:Gem::Dependency
124
+ requirement: &id008 !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
146
133
  type: :development
134
+ name: pg
135
+ version_requirements: *id008
147
136
  prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ! '>='
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: uuidtools
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ! '>='
158
- - !ruby/object:Gem::Version
159
- version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ requirement: &id009 !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
146
+ version: "0"
160
147
  type: :development
148
+ name: sqlite3
149
+ version_requirements: *id009
161
150
  prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: strong_parameters
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
151
+ - !ruby/object:Gem::Dependency
152
+ requirement: &id010 !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
174
161
  type: :development
162
+ name: uuidtools
163
+ version_requirements: *id010
175
164
  prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ! '>='
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
165
  description: Easily and efficiently make your ActiveRecord model support hierarchies
182
- email:
166
+ email:
183
167
  - matthew-github@mceachen.org
184
168
  executables: []
169
+
185
170
  extensions: []
171
+
186
172
  extra_rdoc_files: []
187
- files:
173
+
174
+ files:
188
175
  - lib/closure_tree/acts_as_tree.rb
189
176
  - lib/closure_tree/deterministic_ordering.rb
190
177
  - lib/closure_tree/model.rb
@@ -201,51 +188,65 @@ files:
201
188
  - spec/db/schema.rb
202
189
  - spec/fixtures/labels.yml
203
190
  - spec/fixtures/tags.yml
204
- - spec/hash_tree_spec.rb
205
191
  - spec/label_spec.rb
206
192
  - spec/namespace_type_spec.rb
207
193
  - spec/parallel_prepend_sibling_spec.rb
208
194
  - spec/parallel_spec.rb
209
195
  - spec/spec_helper.rb
210
196
  - spec/support/models.rb
197
+ - spec/tag_examples.rb
198
+ - spec/tag_fixture_examples.rb
211
199
  - spec/tag_spec.rb
212
200
  - spec/user_spec.rb
213
- homepage: http://matthew.mceachen.us/closure_tree
201
+ - spec/uuid_tag_spec.rb
202
+ has_rdoc: true
203
+ homepage: http://mceachen.github.io/closure_tree/
214
204
  licenses: []
215
- metadata: {}
205
+
216
206
  post_install_message:
217
207
  rdoc_options: []
218
- require_paths:
208
+
209
+ require_paths:
219
210
  - lib
220
- required_ruby_version: !ruby/object:Gem::Requirement
221
- requirements:
222
- - - ! '>='
223
- - !ruby/object:Gem::Version
224
- version: '0'
225
- required_rubygems_version: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - ! '>='
228
- - !ruby/object:Gem::Version
229
- version: '0'
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ none: false
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ hash: 3
217
+ segments:
218
+ - 0
219
+ version: "0"
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ none: false
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ hash: 3
226
+ segments:
227
+ - 0
228
+ version: "0"
230
229
  requirements: []
230
+
231
231
  rubyforge_project:
232
- rubygems_version: 2.0.3
232
+ rubygems_version: 1.6.2
233
233
  signing_key:
234
- specification_version: 4
234
+ specification_version: 3
235
235
  summary: Easily and efficiently make your ActiveRecord model support hierarchies
236
- test_files:
236
+ test_files:
237
237
  - spec/cuisine_type_spec.rb
238
238
  - spec/db/database.yml
239
239
  - spec/db/schema.rb
240
240
  - spec/fixtures/labels.yml
241
241
  - spec/fixtures/tags.yml
242
- - spec/hash_tree_spec.rb
243
242
  - spec/label_spec.rb
244
243
  - spec/namespace_type_spec.rb
245
244
  - spec/parallel_prepend_sibling_spec.rb
246
245
  - spec/parallel_spec.rb
247
246
  - spec/spec_helper.rb
248
247
  - spec/support/models.rb
248
+ - spec/tag_examples.rb
249
+ - spec/tag_fixture_examples.rb
249
250
  - spec/tag_spec.rb
250
251
  - spec/user_spec.rb
251
- has_rdoc:
252
+ - spec/uuid_tag_spec.rb