aguids-positionable 0.2.1
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/.document +5 -0
- data/.gitignore +11 -0
- data/LICENSE +20 -0
- data/README.markdown +200 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/app/controllers/positionable_controller.rb +32 -0
- data/app/helpers/positionable_helper.rb +70 -0
- data/config/routes.rb +3 -0
- data/init.rb +1 -0
- data/lib/positionable.rb +362 -0
- data/positionable.gemspec +154 -0
- data/test/rails_root/Rakefile +10 -0
- data/test/rails_root/app/controllers/application_controller.rb +10 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/models/conditional_item.rb +3 -0
- data/test/rails_root/app/models/different_position_column_item.rb +3 -0
- data/test/rails_root/app/models/hell_on_earth_item.rb +5 -0
- data/test/rails_root/app/models/multiple_list_item.rb +5 -0
- data/test/rails_root/app/models/multiple_scoped_item.rb +3 -0
- data/test/rails_root/app/models/scoped_item.rb +3 -0
- data/test/rails_root/app/models/simple_item.rb +4 -0
- data/test/rails_root/config/boot.rb +110 -0
- data/test/rails_root/config/database.yml +22 -0
- data/test/rails_root/config/environment.rb +14 -0
- data/test/rails_root/config/environments/development.rb +17 -0
- data/test/rails_root/config/environments/production.rb +28 -0
- data/test/rails_root/config/environments/test.rb +28 -0
- data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/initializers/new_rails_defaults.rb +19 -0
- data/test/rails_root/config/initializers/session_store.rb +15 -0
- data/test/rails_root/config/locales/en.yml +5 -0
- data/test/rails_root/config/routes.rb +45 -0
- data/test/rails_root/db/development.sqlite3 +0 -0
- data/test/rails_root/db/migrate/20090702170207_create_simple_items.rb +13 -0
- data/test/rails_root/db/migrate/20090703071830_create_scoped_items.rb +14 -0
- data/test/rails_root/db/migrate/20090706180046_create_different_position_column_items.rb +13 -0
- data/test/rails_root/db/migrate/20090706200318_create_conditional_items.rb +14 -0
- data/test/rails_root/db/migrate/20090708045618_create_multiple_scoped_items.rb +15 -0
- data/test/rails_root/db/migrate/20090708174947_create_multiple_list_items.rb +15 -0
- data/test/rails_root/db/migrate/20090708183550_create_hell_on_earth_items.rb +19 -0
- data/test/rails_root/db/schema.rb +68 -0
- data/test/rails_root/script/about +4 -0
- data/test/rails_root/script/console +3 -0
- data/test/rails_root/script/dbconsole +3 -0
- data/test/rails_root/script/destroy +3 -0
- data/test/rails_root/script/generate +3 -0
- data/test/rails_root/script/performance/benchmarker +3 -0
- data/test/rails_root/script/performance/profiler +3 -0
- data/test/rails_root/script/plugin +3 -0
- data/test/rails_root/script/runner +3 -0
- data/test/rails_root/script/server +3 -0
- data/test/rails_root/test/conditional_tests.rb +28 -0
- data/test/rails_root/test/functional/positionable_controller_test.rb +50 -0
- data/test/rails_root/test/performance/browsing_test.rb +9 -0
- data/test/rails_root/test/scoped_tests.rb +53 -0
- data/test/rails_root/test/simple_gap_tests.rb +17 -0
- data/test/rails_root/test/simple_gapless_tests.rb +52 -0
- data/test/rails_root/test/simple_tests.rb +185 -0
- data/test/rails_root/test/test_helper.rb +37 -0
- data/test/rails_root/test/unit/conditional_item_test.rb +36 -0
- data/test/rails_root/test/unit/different_position_column_item_test.rb +21 -0
- data/test/rails_root/test/unit/eval_support_test.rb +62 -0
- data/test/rails_root/test/unit/hell_on_earth_item_test.rb +71 -0
- data/test/rails_root/test/unit/helpers/positionable_helper_test.rb +69 -0
- data/test/rails_root/test/unit/multiple_list_item_test.rb +60 -0
- data/test/rails_root/test/unit/multiple_scoped_item_test.rb +34 -0
- data/test/rails_root/test/unit/scoped_item_test.rb +22 -0
- data/test/rails_root/test/unit/scoped_item_with_gaps_test.rb +25 -0
- data/test/rails_root/test/unit/simple_item_test.rb +21 -0
- data/test/rails_root/test/unit/simple_item_with_gaps_test.rb +24 -0
- metadata +172 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class MultipleScopedItemTest < ActiveSupport::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
16.times { |index| MultipleScopedItem.create :parent_id => index % 2, :tag => "tag_#{index % 4}"}
|
|
6
|
+
@items = MultipleScopedItem.find(:all, :order => 'id', :conditions => {:parent_id => 1, :tag => 'tag_1'})
|
|
7
|
+
@ids = @items.map(&:id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
include SimpleTests
|
|
11
|
+
include SimpleGaplessTests
|
|
12
|
+
include ScopedTests
|
|
13
|
+
|
|
14
|
+
def test_multiple_scopes_true_nil_scope
|
|
15
|
+
item = multiple_create(nil, nil)
|
|
16
|
+
assert item.in_list?
|
|
17
|
+
assert item.first?
|
|
18
|
+
assert item.last?
|
|
19
|
+
assert_equal 1, item.list_position
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
def ordered_ids
|
|
24
|
+
MultipleScopedItem.find(:all, :order => 'position', :conditions => "parent_id = 1 AND tag = 'tag_1' AND position IS NOT NULL").map(&:id)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def create(parent_id)
|
|
28
|
+
MultipleScopedItem.create(:parent_id => parent_id, :tag => 'tag_1')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def multiple_create(parent_id, tag)
|
|
32
|
+
MultipleScopedItem.create(:parent_id => parent_id, :tag => tag)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class ScopedItemTest < ActiveSupport::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
8.times { |index| ScopedItem.create :parent_id => index % 2}
|
|
6
|
+
@items = ScopedItem.find(:all, :order => 'id', :conditions => {:parent_id => 1})
|
|
7
|
+
@ids = @items.map(&:id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
include SimpleTests
|
|
11
|
+
include SimpleGaplessTests
|
|
12
|
+
include ScopedTests
|
|
13
|
+
|
|
14
|
+
protected
|
|
15
|
+
def ordered_ids
|
|
16
|
+
ScopedItem.find(:all, :order => 'position', :conditions => 'parent_id = 1 AND position IS NOT NULL').map(&:id)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create(parent_id)
|
|
20
|
+
ScopedItem.create(:parent_id => parent_id)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class ScopedItemWithGapsTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
# Lists: 1 (gap) 2 (gap) (gap) 3 (gap) 4
|
|
6
|
+
def setup
|
|
7
|
+
16.times { |index| ScopedItem.create :parent_id => index % 2}
|
|
8
|
+
[3,4,7,8,9,10,13,14].each { |index| ScopedItem.delete(index) }
|
|
9
|
+
@items = ScopedItem.find(:all, :order => 'id', :conditions => {:parent_id => 1})
|
|
10
|
+
@ids = @items.map(&:id)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
include SimpleTests
|
|
14
|
+
include ScopedTests
|
|
15
|
+
include SimpleGapTests
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
def ordered_ids
|
|
19
|
+
ScopedItem.find(:all, :order => 'position', :conditions => 'parent_id = 1 AND position IS NOT NULL').map(&:id)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(parent_id)
|
|
23
|
+
ScopedItem.create(:parent_id => parent_id)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class SimpleItemTest < ActiveSupport::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
4.times { SimpleItem.create }
|
|
6
|
+
@items = SimpleItem.find(:all, :order => 'id')
|
|
7
|
+
@ids = @items.map(&:id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
include SimpleTests
|
|
11
|
+
include SimpleGaplessTests
|
|
12
|
+
|
|
13
|
+
protected
|
|
14
|
+
def ordered_ids
|
|
15
|
+
SimpleItem.find(:all, :order => 'position', :conditions => 'position IS NOT NULL').map(&:id)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def create(*args)
|
|
19
|
+
SimpleItem.create
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class SimpleItemWithGapsTest < ActiveSupport::TestCase
|
|
4
|
+
|
|
5
|
+
# List: 1 (gap) 2 (gap) (gap) 3 (gap) 4
|
|
6
|
+
def setup
|
|
7
|
+
8.times { SimpleItem.create }
|
|
8
|
+
[2,4,5,7].each { |index| SimpleItem.delete(index) }
|
|
9
|
+
@items = SimpleItem.find(:all, :order => 'id')
|
|
10
|
+
@ids = @items.map(&:id)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
include SimpleTests
|
|
14
|
+
include SimpleGapTests
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
def ordered_ids
|
|
18
|
+
SimpleItem.find(:all, :order => 'position', :conditions => 'position IS NOT NULL').map(&:id)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create(*args)
|
|
22
|
+
SimpleItem.create
|
|
23
|
+
end
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: aguids-positionable
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Felipe Doria
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-07-10 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description:
|
|
17
|
+
email: felipe.doria@gmail.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- LICENSE
|
|
24
|
+
- README.markdown
|
|
25
|
+
files:
|
|
26
|
+
- .document
|
|
27
|
+
- .gitignore
|
|
28
|
+
- LICENSE
|
|
29
|
+
- README.markdown
|
|
30
|
+
- Rakefile
|
|
31
|
+
- VERSION
|
|
32
|
+
- app/controllers/positionable_controller.rb
|
|
33
|
+
- app/helpers/positionable_helper.rb
|
|
34
|
+
- config/routes.rb
|
|
35
|
+
- init.rb
|
|
36
|
+
- lib/positionable.rb
|
|
37
|
+
- positionable.gemspec
|
|
38
|
+
- test/rails_root/Rakefile
|
|
39
|
+
- test/rails_root/app/controllers/application_controller.rb
|
|
40
|
+
- test/rails_root/app/helpers/application_helper.rb
|
|
41
|
+
- test/rails_root/app/models/conditional_item.rb
|
|
42
|
+
- test/rails_root/app/models/different_position_column_item.rb
|
|
43
|
+
- test/rails_root/app/models/hell_on_earth_item.rb
|
|
44
|
+
- test/rails_root/app/models/multiple_list_item.rb
|
|
45
|
+
- test/rails_root/app/models/multiple_scoped_item.rb
|
|
46
|
+
- test/rails_root/app/models/scoped_item.rb
|
|
47
|
+
- test/rails_root/app/models/simple_item.rb
|
|
48
|
+
- test/rails_root/config/boot.rb
|
|
49
|
+
- test/rails_root/config/database.yml
|
|
50
|
+
- test/rails_root/config/environment.rb
|
|
51
|
+
- test/rails_root/config/environments/development.rb
|
|
52
|
+
- test/rails_root/config/environments/production.rb
|
|
53
|
+
- test/rails_root/config/environments/test.rb
|
|
54
|
+
- test/rails_root/config/initializers/backtrace_silencers.rb
|
|
55
|
+
- test/rails_root/config/initializers/inflections.rb
|
|
56
|
+
- test/rails_root/config/initializers/mime_types.rb
|
|
57
|
+
- test/rails_root/config/initializers/new_rails_defaults.rb
|
|
58
|
+
- test/rails_root/config/initializers/session_store.rb
|
|
59
|
+
- test/rails_root/config/locales/en.yml
|
|
60
|
+
- test/rails_root/config/routes.rb
|
|
61
|
+
- test/rails_root/db/development.sqlite3
|
|
62
|
+
- test/rails_root/db/migrate/20090702170207_create_simple_items.rb
|
|
63
|
+
- test/rails_root/db/migrate/20090703071830_create_scoped_items.rb
|
|
64
|
+
- test/rails_root/db/migrate/20090706180046_create_different_position_column_items.rb
|
|
65
|
+
- test/rails_root/db/migrate/20090706200318_create_conditional_items.rb
|
|
66
|
+
- test/rails_root/db/migrate/20090708045618_create_multiple_scoped_items.rb
|
|
67
|
+
- test/rails_root/db/migrate/20090708174947_create_multiple_list_items.rb
|
|
68
|
+
- test/rails_root/db/migrate/20090708183550_create_hell_on_earth_items.rb
|
|
69
|
+
- test/rails_root/db/schema.rb
|
|
70
|
+
- test/rails_root/script/about
|
|
71
|
+
- test/rails_root/script/console
|
|
72
|
+
- test/rails_root/script/dbconsole
|
|
73
|
+
- test/rails_root/script/destroy
|
|
74
|
+
- test/rails_root/script/generate
|
|
75
|
+
- test/rails_root/script/performance/benchmarker
|
|
76
|
+
- test/rails_root/script/performance/profiler
|
|
77
|
+
- test/rails_root/script/plugin
|
|
78
|
+
- test/rails_root/script/runner
|
|
79
|
+
- test/rails_root/script/server
|
|
80
|
+
- test/rails_root/test/conditional_tests.rb
|
|
81
|
+
- test/rails_root/test/functional/positionable_controller_test.rb
|
|
82
|
+
- test/rails_root/test/performance/browsing_test.rb
|
|
83
|
+
- test/rails_root/test/scoped_tests.rb
|
|
84
|
+
- test/rails_root/test/simple_gap_tests.rb
|
|
85
|
+
- test/rails_root/test/simple_gapless_tests.rb
|
|
86
|
+
- test/rails_root/test/simple_tests.rb
|
|
87
|
+
- test/rails_root/test/test_helper.rb
|
|
88
|
+
- test/rails_root/test/unit/conditional_item_test.rb
|
|
89
|
+
- test/rails_root/test/unit/different_position_column_item_test.rb
|
|
90
|
+
- test/rails_root/test/unit/eval_support_test.rb
|
|
91
|
+
- test/rails_root/test/unit/hell_on_earth_item_test.rb
|
|
92
|
+
- test/rails_root/test/unit/helpers/positionable_helper_test.rb
|
|
93
|
+
- test/rails_root/test/unit/multiple_list_item_test.rb
|
|
94
|
+
- test/rails_root/test/unit/multiple_scoped_item_test.rb
|
|
95
|
+
- test/rails_root/test/unit/scoped_item_test.rb
|
|
96
|
+
- test/rails_root/test/unit/scoped_item_with_gaps_test.rb
|
|
97
|
+
- test/rails_root/test/unit/simple_item_test.rb
|
|
98
|
+
- test/rails_root/test/unit/simple_item_with_gaps_test.rb
|
|
99
|
+
has_rdoc: false
|
|
100
|
+
homepage: http://github.com/aguids/positionable
|
|
101
|
+
post_install_message:
|
|
102
|
+
rdoc_options:
|
|
103
|
+
- --charset=UTF-8
|
|
104
|
+
require_paths:
|
|
105
|
+
- lib
|
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: "0"
|
|
111
|
+
version:
|
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: "0"
|
|
117
|
+
version:
|
|
118
|
+
requirements: []
|
|
119
|
+
|
|
120
|
+
rubyforge_project:
|
|
121
|
+
rubygems_version: 1.2.0
|
|
122
|
+
signing_key:
|
|
123
|
+
specification_version: 3
|
|
124
|
+
summary: acts-as-list extension stretched to controllers and helpers
|
|
125
|
+
test_files:
|
|
126
|
+
- test/rails_root/app/controllers/application_controller.rb
|
|
127
|
+
- test/rails_root/app/helpers/application_helper.rb
|
|
128
|
+
- test/rails_root/app/models/conditional_item.rb
|
|
129
|
+
- test/rails_root/app/models/different_position_column_item.rb
|
|
130
|
+
- test/rails_root/app/models/hell_on_earth_item.rb
|
|
131
|
+
- test/rails_root/app/models/multiple_list_item.rb
|
|
132
|
+
- test/rails_root/app/models/multiple_scoped_item.rb
|
|
133
|
+
- test/rails_root/app/models/scoped_item.rb
|
|
134
|
+
- test/rails_root/app/models/simple_item.rb
|
|
135
|
+
- test/rails_root/config/boot.rb
|
|
136
|
+
- test/rails_root/config/environment.rb
|
|
137
|
+
- test/rails_root/config/environments/development.rb
|
|
138
|
+
- test/rails_root/config/environments/production.rb
|
|
139
|
+
- test/rails_root/config/environments/test.rb
|
|
140
|
+
- test/rails_root/config/initializers/backtrace_silencers.rb
|
|
141
|
+
- test/rails_root/config/initializers/inflections.rb
|
|
142
|
+
- test/rails_root/config/initializers/mime_types.rb
|
|
143
|
+
- test/rails_root/config/initializers/new_rails_defaults.rb
|
|
144
|
+
- test/rails_root/config/initializers/session_store.rb
|
|
145
|
+
- test/rails_root/config/routes.rb
|
|
146
|
+
- test/rails_root/db/migrate/20090702170207_create_simple_items.rb
|
|
147
|
+
- test/rails_root/db/migrate/20090703071830_create_scoped_items.rb
|
|
148
|
+
- test/rails_root/db/migrate/20090706180046_create_different_position_column_items.rb
|
|
149
|
+
- test/rails_root/db/migrate/20090706200318_create_conditional_items.rb
|
|
150
|
+
- test/rails_root/db/migrate/20090708045618_create_multiple_scoped_items.rb
|
|
151
|
+
- test/rails_root/db/migrate/20090708174947_create_multiple_list_items.rb
|
|
152
|
+
- test/rails_root/db/migrate/20090708183550_create_hell_on_earth_items.rb
|
|
153
|
+
- test/rails_root/db/schema.rb
|
|
154
|
+
- test/rails_root/test/conditional_tests.rb
|
|
155
|
+
- test/rails_root/test/functional/positionable_controller_test.rb
|
|
156
|
+
- test/rails_root/test/performance/browsing_test.rb
|
|
157
|
+
- test/rails_root/test/scoped_tests.rb
|
|
158
|
+
- test/rails_root/test/simple_gap_tests.rb
|
|
159
|
+
- test/rails_root/test/simple_gapless_tests.rb
|
|
160
|
+
- test/rails_root/test/simple_tests.rb
|
|
161
|
+
- test/rails_root/test/test_helper.rb
|
|
162
|
+
- test/rails_root/test/unit/conditional_item_test.rb
|
|
163
|
+
- test/rails_root/test/unit/different_position_column_item_test.rb
|
|
164
|
+
- test/rails_root/test/unit/eval_support_test.rb
|
|
165
|
+
- test/rails_root/test/unit/hell_on_earth_item_test.rb
|
|
166
|
+
- test/rails_root/test/unit/helpers/positionable_helper_test.rb
|
|
167
|
+
- test/rails_root/test/unit/multiple_list_item_test.rb
|
|
168
|
+
- test/rails_root/test/unit/multiple_scoped_item_test.rb
|
|
169
|
+
- test/rails_root/test/unit/scoped_item_test.rb
|
|
170
|
+
- test/rails_root/test/unit/scoped_item_with_gaps_test.rb
|
|
171
|
+
- test/rails_root/test/unit/simple_item_test.rb
|
|
172
|
+
- test/rails_root/test/unit/simple_item_with_gaps_test.rb
|