moretea-awesome_nested_set 1.4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +13 -0
- data/.gitignore +6 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +90 -0
- data/Rakefile +57 -0
- data/VERSION +1 -0
- data/awesome_nested_set.gemspec +71 -0
- data/init.rb +2 -0
- data/lib/awesome_nested_set.rb +13 -0
- data/lib/awesome_nested_set/base.rb +601 -0
- data/lib/awesome_nested_set/depth.rb +41 -0
- data/lib/awesome_nested_set/descendants.rb +26 -0
- data/lib/awesome_nested_set/helper.rb +40 -0
- data/lib/awesome_nested_set/railtie.rb +21 -0
- data/rails/init.rb +2 -0
- data/test/application.rb +1 -0
- data/test/awesome_nested_set/helper_test.rb +41 -0
- data/test/awesome_nested_set_test.rb +799 -0
- data/test/db/database.yml +18 -0
- data/test/db/schema.rb +30 -0
- data/test/fixtures/categories.yml +34 -0
- data/test/fixtures/category.rb +15 -0
- data/test/fixtures/departments.yml +3 -0
- data/test/fixtures/notes.yml +38 -0
- data/test/test_helper.rb +32 -0
- metadata +120 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
sqlite3:
|
2
|
+
adapter: sqlite3
|
3
|
+
database: awesome_nested_set.sqlite3.db
|
4
|
+
sqlite3mem:
|
5
|
+
adapter: sqlite3
|
6
|
+
database: ":memory:"
|
7
|
+
postgresql:
|
8
|
+
adapter: postgresql
|
9
|
+
username: postgres
|
10
|
+
password: postgres
|
11
|
+
database: awesome_nested_set_plugin_test
|
12
|
+
min_messages: ERROR
|
13
|
+
mysql:
|
14
|
+
adapter: mysql
|
15
|
+
host: localhost
|
16
|
+
username: root
|
17
|
+
password:
|
18
|
+
database: awesome_nested_set_plugin_test
|
data/test/db/schema.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
|
3
|
+
create_table :categories, :force => true do |t|
|
4
|
+
t.column :name, :string
|
5
|
+
t.column :parent_id, :integer
|
6
|
+
t.column :lft, :integer
|
7
|
+
t.column :rgt, :integer
|
8
|
+
t.column :organization_id, :integer
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :departments, :force => true do |t|
|
12
|
+
t.column :name, :string
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :notes, :force => true do |t|
|
16
|
+
t.column :body, :text
|
17
|
+
t.column :parent_id, :integer
|
18
|
+
t.column :lft, :integer
|
19
|
+
t.column :rgt, :integer
|
20
|
+
t.column :notable_id, :integer
|
21
|
+
t.column :notable_type, :string
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table :renamed_columns, :force => true do |t|
|
25
|
+
t.column :name, :string
|
26
|
+
t.column :mother_id, :integer
|
27
|
+
t.column :red, :integer
|
28
|
+
t.column :black, :integer
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
top_level:
|
2
|
+
id: 1
|
3
|
+
name: Top Level
|
4
|
+
lft: 1
|
5
|
+
rgt: 10
|
6
|
+
child_1:
|
7
|
+
id: 2
|
8
|
+
name: Child 1
|
9
|
+
parent_id: 1
|
10
|
+
lft: 2
|
11
|
+
rgt: 3
|
12
|
+
child_2:
|
13
|
+
id: 3
|
14
|
+
name: Child 2
|
15
|
+
parent_id: 1
|
16
|
+
lft: 4
|
17
|
+
rgt: 7
|
18
|
+
child_2_1:
|
19
|
+
id: 4
|
20
|
+
name: Child 2.1
|
21
|
+
parent_id: 3
|
22
|
+
lft: 5
|
23
|
+
rgt: 6
|
24
|
+
child_3:
|
25
|
+
id: 5
|
26
|
+
name: Child 3
|
27
|
+
parent_id: 1
|
28
|
+
lft: 8
|
29
|
+
rgt: 9
|
30
|
+
top_level_2:
|
31
|
+
id: 6
|
32
|
+
name: Top Level 2
|
33
|
+
lft: 11
|
34
|
+
rgt: 12
|
@@ -0,0 +1,38 @@
|
|
1
|
+
scope1:
|
2
|
+
id: 1
|
3
|
+
body: Top Level
|
4
|
+
lft: 1
|
5
|
+
rgt: 10
|
6
|
+
notable_id: 1
|
7
|
+
notable_type: Category
|
8
|
+
child_1:
|
9
|
+
id: 2
|
10
|
+
body: Child 1
|
11
|
+
parent_id: 1
|
12
|
+
lft: 2
|
13
|
+
rgt: 3
|
14
|
+
notable_id: 1
|
15
|
+
notable_type: Category
|
16
|
+
child_2:
|
17
|
+
id: 3
|
18
|
+
body: Child 2
|
19
|
+
parent_id: 1
|
20
|
+
lft: 4
|
21
|
+
rgt: 7
|
22
|
+
notable_id: 1
|
23
|
+
notable_type: Category
|
24
|
+
child_3:
|
25
|
+
id: 4
|
26
|
+
body: Child 3
|
27
|
+
parent_id: 1
|
28
|
+
lft: 8
|
29
|
+
rgt: 9
|
30
|
+
notable_id: 1
|
31
|
+
notable_type: Category
|
32
|
+
scope2:
|
33
|
+
id: 5
|
34
|
+
body: Top Level 2
|
35
|
+
lft: 1
|
36
|
+
rgt: 2
|
37
|
+
notable_id: 1
|
38
|
+
notable_type: Departments
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
plugin_test_dir = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
$:.unshift(plugin_test_dir + '/../lib')
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'test/unit'
|
7
|
+
require 'active_support'
|
8
|
+
require 'active_support/test_case'
|
9
|
+
require 'active_record'
|
10
|
+
require 'action_pack'
|
11
|
+
require 'awesome_nested_set'
|
12
|
+
|
13
|
+
CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record
|
14
|
+
|
15
|
+
ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")
|
16
|
+
|
17
|
+
ActiveRecord::Base.configurations = YAML::load(IO.read(plugin_test_dir + "/db/database.yml"))
|
18
|
+
ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
|
19
|
+
ActiveRecord::Migration.verbose = false
|
20
|
+
load(File.join(plugin_test_dir, "db", "schema.rb"))
|
21
|
+
|
22
|
+
Dir["#{plugin_test_dir}/fixtures/*.rb"].each {|file| require file }
|
23
|
+
|
24
|
+
class ActiveSupport::TestCase #:nodoc:
|
25
|
+
include ActiveRecord::TestFixtures
|
26
|
+
|
27
|
+
self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
28
|
+
self.use_transactional_fixtures = true
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
fixtures :categories, :notes, :departments
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moretea-awesome_nested_set
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 113
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 4
|
9
|
+
- 3
|
10
|
+
- 1
|
11
|
+
version: 1.4.3.1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Brandon Keepers
|
15
|
+
- Daniel Morrison
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2010-08-31 00:00:00 +02:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: activerecord
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 7
|
32
|
+
segments:
|
33
|
+
- 3
|
34
|
+
- 0
|
35
|
+
- 0
|
36
|
+
version: 3.0.0
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
39
|
+
description: An awesome nested set implementation for Active Record
|
40
|
+
email: info@collectiveidea.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.rdoc
|
47
|
+
files:
|
48
|
+
- .autotest
|
49
|
+
- .gitignore
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.rdoc
|
52
|
+
- Rakefile
|
53
|
+
- VERSION
|
54
|
+
- awesome_nested_set.gemspec
|
55
|
+
- init.rb
|
56
|
+
- lib/awesome_nested_set.rb
|
57
|
+
- lib/awesome_nested_set/base.rb
|
58
|
+
- lib/awesome_nested_set/depth.rb
|
59
|
+
- lib/awesome_nested_set/descendants.rb
|
60
|
+
- lib/awesome_nested_set/helper.rb
|
61
|
+
- lib/awesome_nested_set/railtie.rb
|
62
|
+
- rails/init.rb
|
63
|
+
- test/application.rb
|
64
|
+
- test/awesome_nested_set/helper_test.rb
|
65
|
+
- test/awesome_nested_set_test.rb
|
66
|
+
- test/db/database.yml
|
67
|
+
- test/db/schema.rb
|
68
|
+
- test/fixtures/categories.yml
|
69
|
+
- test/fixtures/category.rb
|
70
|
+
- test/fixtures/departments.yml
|
71
|
+
- test/fixtures/notes.yml
|
72
|
+
- test/test_helper.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: http://github.com/collectiveidea/awesome_nested_set
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options:
|
79
|
+
- --main
|
80
|
+
- README.rdoc
|
81
|
+
- --inline-source
|
82
|
+
- --line-numbers
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.3.7
|
107
|
+
signing_key:
|
108
|
+
specification_version: 3
|
109
|
+
summary: An awesome nested set implementation for Active Record
|
110
|
+
test_files:
|
111
|
+
- test/db/database.yml
|
112
|
+
- test/fixtures/departments.yml
|
113
|
+
- test/fixtures/categories.yml
|
114
|
+
- test/fixtures/notes.yml
|
115
|
+
- test/test_helper.rb
|
116
|
+
- test/application.rb
|
117
|
+
- test/db/schema.rb
|
118
|
+
- test/awesome_nested_set_test.rb
|
119
|
+
- test/awesome_nested_set/helper_test.rb
|
120
|
+
- test/fixtures/category.rb
|