guilded 1.1.0 → 2.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/.gitignore +17 -4
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -1
  4. data/Gemfile +1 -21
  5. data/Guardfile +5 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +21 -0
  8. data/Rakefile +1 -1
  9. data/guilded.gemspec +23 -24
  10. data/lib/{generators/guilded_assets/templates → assets/javascripts}/guilded.js +0 -0
  11. data/lib/assets/javascripts/jquery-1.6.4.js +9046 -0
  12. data/lib/assets/javascripts/jquery-1.6.4.min.js +4 -0
  13. data/lib/assets/javascripts/jquery-1.7.1.js +9266 -0
  14. data/lib/assets/javascripts/jquery-1.7.1.min.js +4 -0
  15. data/lib/assets/javascripts/jquery-1.7.2.js +9404 -0
  16. data/lib/assets/javascripts/jquery-1.7.2.min.js +4 -0
  17. data/lib/assets/javascripts/jquery-1.8.0.js +9227 -0
  18. data/lib/assets/javascripts/jquery-1.8.0.min.js +2 -0
  19. data/lib/assets/javascripts/jquery-1.8.1.js +9301 -0
  20. data/lib/assets/javascripts/jquery-1.8.1.min.js +2 -0
  21. data/lib/assets/javascripts/jquery-1.8.2.js +9440 -0
  22. data/lib/assets/javascripts/jquery-1.8.2.min.js +2 -0
  23. data/lib/assets/javascripts/jquery-1.8.3.js +9472 -0
  24. data/lib/assets/javascripts/jquery-1.8.3.min.js +2 -0
  25. data/lib/assets/javascripts/jquery-1.9.0.js +9555 -0
  26. data/lib/assets/javascripts/jquery-1.9.0.min.js +4 -0
  27. data/lib/assets/javascripts/jquery-1.9.1.js +9597 -0
  28. data/lib/assets/javascripts/jquery-1.9.1.min.js +5 -0
  29. data/lib/guilded.rb +23 -73
  30. data/lib/guilded/component.rb +32 -0
  31. data/lib/guilded/configuration.rb +27 -0
  32. data/lib/guilded/data.rb +25 -0
  33. data/lib/guilded/engine.rb +5 -0
  34. data/lib/guilded/guilder.rb +27 -370
  35. data/lib/guilded/rails.rb +7 -4
  36. data/lib/guilded/rails/controller.rb +23 -0
  37. data/lib/guilded/rails/helpers.rb +1 -3
  38. data/lib/guilded/rails/view_helpers.rb +16 -112
  39. data/lib/guilded/version.rb +1 -1
  40. data/spec/guilded/component_spec.rb +13 -0
  41. data/spec/guilded/configuration_spec.rb +68 -0
  42. data/spec/guilded/data_spec.rb +29 -0
  43. data/spec/guilded/guilder_spec.rb +67 -63
  44. data/spec/guilded/rails/view_helpers_spec.rb +49 -0
  45. data/spec/spec_helper.rb +5 -29
  46. metadata +174 -122
  47. data/Gemfile.lock +0 -61
  48. data/README.rdoc +0 -204
  49. data/lib/generators/guilded_assets/guilded_assets_generator.rb +0 -21
  50. data/lib/generators/guilded_assets/templates/guilded.min.js +0 -1
  51. data/lib/generators/guilded_assets/templates/jquery-1.2.6.js +0 -3549
  52. data/lib/generators/guilded_assets/templates/jquery-1.2.6.min.js +0 -32
  53. data/lib/generators/guilded_assets/templates/jquery-1.3.2.js +0 -4376
  54. data/lib/generators/guilded_assets/templates/jquery-1.3.2.min.js +0 -19
  55. data/lib/generators/guilded_assets/templates/jquery-url.js +0 -199
  56. data/lib/generators/guilded_assets/templates/jquery-url.min.js +0 -9
  57. data/lib/generators/guilded_assets/templates/mootools-1.2.3.js +0 -4036
  58. data/lib/generators/guilded_assets/templates/mootools-1.2.3.min.js +0 -356
  59. data/lib/generators/guilded_assets/templates/reset-min.css +0 -7
  60. data/lib/generators/guilded_config/guilded_config_generator.rb +0 -11
  61. data/lib/generators/guilded_config/templates/guilded_config.rb +0 -16
  62. data/lib/guilded/component_def.rb +0 -27
  63. data/lib/guilded/exceptions.rb +0 -29
  64. data/lib/guilded/rails/active_record/human_attribute_hint.rb +0 -41
  65. data/lib/guilded/rails/controller_actions.rb +0 -22
  66. data/lib/guilded/rails/inactive_record/human_attribute_hint.rb +0 -26
  67. data/rails_generators/guilded_assets/guilded_assets_generator.rb +0 -23
  68. data/rails_generators/guilded_assets/templates/guilded.js +0 -12
  69. data/rails_generators/guilded_assets/templates/guilded.min.js +0 -1
  70. data/rails_generators/guilded_assets/templates/jquery-1.2.6.js +0 -3549
  71. data/rails_generators/guilded_assets/templates/jquery-1.2.6.min.js +0 -32
  72. data/rails_generators/guilded_assets/templates/jquery-1.3.2.js +0 -4376
  73. data/rails_generators/guilded_assets/templates/jquery-1.3.2.min.js +0 -19
  74. data/rails_generators/guilded_assets/templates/jquery-url.js +0 -199
  75. data/rails_generators/guilded_assets/templates/jquery-url.min.js +0 -9
  76. data/rails_generators/guilded_assets/templates/mootools-1.2.3.js +0 -4036
  77. data/rails_generators/guilded_assets/templates/mootools-1.2.3.min.js +0 -356
  78. data/rails_generators/guilded_assets/templates/reset-min.css +0 -7
  79. data/rails_generators/guilded_config/guilded_config_generator.rb +0 -11
  80. data/rails_generators/guilded_config/templates/guilded_config.rb +0 -16
  81. data/script/console +0 -10
  82. data/script/destroy +0 -14
  83. data/script/generate +0 -14
  84. data/spec/generators/guilded_assets_generator_spec.rb +0 -35
  85. data/spec/generators/guilded_config_generator_spec.rb +0 -24
  86. data/spec/guilded/component_def_spec.rb +0 -24
  87. data/spec/guilded_spec.rb +0 -7
  88. data/spec/spec.opts +0 -7
  89. data/tasks/rails.rake +0 -8
  90. data/tasks/rspec.rake +0 -21
  91. data/test/guilded/rails/helpers_test.rb +0 -1450
  92. data/test/test_helper.rb +0 -39
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
- require 'generators/guilded_config/guilded_config_generator'
3
-
4
- describe GuildedConfigGenerator do
5
- before :each do
6
- @destination = File.join 'tmp', 'test_app'
7
- @source = GuildedConfigGenerator.source_root
8
- GuildedConfigGenerator.start '', :destination_root => @destination
9
- end
10
-
11
- after :each do
12
- FileUtils.rm_rf @destination
13
- end
14
-
15
- {'guilded_config.rb' => 'config/initializers/guilded_config.rb'}.each do |file, path|
16
- it "should copy '#{file}' to '#{path}'" do
17
- File.exists?( File.join( @destination, path ) ).should be_true
18
- end
19
-
20
- it "should agree that the contents of '#{file}' are identical to '#{path}'" do
21
- File.read( File.join( @source, file ) ).should eql File.read( File.join( @destination, path ) )
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- require File.expand_path( File.join( File.dirname(__FILE__), '..', 'spec_helper' ) )
2
-
3
- describe Guilded::ComponentDef do
4
- before :each do
5
- @cd = Guilded::ComponentDef.new( 'grid' )
6
- @cd_exclude = Guilded::ComponentDef.new( 'grid', { :exclude_css => true, :exclude_js => true } )
7
- end
8
-
9
- it "should exclude css if specified" do
10
- @cd_exclude.exclude_css?.should be_true
11
- end
12
-
13
- it "should exclude js if specified" do
14
- @cd_exclude.exclude_js?.should be_true
15
- end
16
-
17
- it "should not exclude css unless specified" do
18
- @cd.exclude_css?.should be_false
19
- end
20
-
21
- it "should not exclude js unless specified" do
22
- @cd.exclude_js?.should be_false
23
- end
24
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path( File.dirname(__FILE__) + '/spec_helper' )
2
-
3
- describe Guilded do
4
- it "should be true" do
5
- true.should be_true
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- --colour
2
- --format progress
3
- --format html:specifications.html
4
- --loadby mtime
5
- --reverse
6
- --backtrace
7
- --debugger
@@ -1,8 +0,0 @@
1
- namespace :guilded do
2
-
3
- desc "Test"
4
- task :test => :environment do
5
- puts 'jason'
6
- end
7
-
8
- end
@@ -1,21 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
- begin
8
- require 'spec/rake/spectask'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--options', "spec/spec.opts"]
20
- t.spec_files = FileList['spec/**/*_spec.rb']
21
- end
@@ -1,1450 +0,0 @@
1
- require 'test_helper'
2
-
3
- class HelpersTest < Test::Unit::TestCase
4
- context "The helpers" do
5
- setup do
6
- @thing = Thing.new
7
- @things = [Thing.new, Thing.new]
8
- @parent = Parent.new
9
- @owner = Owner.new
10
- @lookup = Lookup.new
11
- @lookups = [Lookup.new, Lookup.new]
12
- end
13
-
14
- should "have class method resolve_field_methods_and_titles" do
15
- assert Guilded::Rails::Helpers.respond_to? :resolve_field_methods_and_titles
16
- end
17
-
18
- should "have class method resolve_rest_path_helpers" do
19
- assert Guilded::Rails::Helpers.respond_to? :resolve_rest_path_helpers
20
- end
21
-
22
- context "single level REST paths given ActiveRecord object" do
23
- setup do
24
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing )
25
- end
26
-
27
- should "resolve index path" do
28
- assert_equal 'things_path', @path_helpers[:index_rest_helper]
29
- end
30
-
31
- should "resolve index args" do
32
- assert_equal [], @path_helpers[:index_rest_args]
33
- end
34
-
35
- should "resolve show path" do
36
- assert_equal 'thing_path', @path_helpers[:show_rest_helper]
37
- end
38
-
39
- should "resolve show args" do
40
- assert_equal [], @path_helpers[:show_rest_args]
41
- end
42
-
43
- should "resolve new path" do
44
- assert_equal 'new_thing_path', @path_helpers[:new_rest_helper]
45
- end
46
-
47
- should "resolve new args" do
48
- assert_equal [], @path_helpers[:new_rest_args]
49
- end
50
-
51
- should "resolve edit path" do
52
- assert_equal 'edit_thing_path', @path_helpers[:edit_rest_helper]
53
- end
54
-
55
- should "resolve edit args" do
56
- assert_equal [], @path_helpers[:edit_rest_args]
57
- end
58
-
59
- should "resolve delete path" do
60
- assert_equal 'delete_thing_path', @path_helpers[:delete_rest_helper]
61
- end
62
-
63
- should "resolve delete args" do
64
- assert_equal [], @path_helpers[:delete_rest_args]
65
- end
66
- end
67
-
68
- context "single level REST paths given ActiveRecord collection" do
69
- setup do
70
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things )
71
- end
72
-
73
- should "resolve index path" do
74
- assert_equal 'things_path', @path_helpers[:index_rest_helper]
75
- end
76
-
77
- should "resolve index args" do
78
- assert_equal [], @path_helpers[:index_rest_args]
79
- end
80
-
81
- should "resolve show path" do
82
- assert_equal 'thing_path', @path_helpers[:show_rest_helper]
83
- end
84
-
85
- should "resolve show args" do
86
- assert_equal [], @path_helpers[:show_rest_args]
87
- end
88
-
89
- should "resolve new path" do
90
- assert_equal 'new_thing_path', @path_helpers[:new_rest_helper]
91
- end
92
-
93
- should "resolve new args" do
94
- assert_equal [], @path_helpers[:new_rest_args]
95
- end
96
-
97
- should "resolve edit path" do
98
- assert_equal 'edit_thing_path', @path_helpers[:edit_rest_helper]
99
- end
100
-
101
- should "resolve edit args" do
102
- assert_equal [], @path_helpers[:edit_rest_args]
103
- end
104
-
105
- should "resolve delete path" do
106
- assert_equal 'delete_thing_path', @path_helpers[:delete_rest_helper]
107
- end
108
-
109
- should "resolve delete args" do
110
- assert_equal [], @path_helpers[:delete_rest_args]
111
- end
112
- end
113
-
114
- context "nested REST paths given ActiveRecord object and scoped by single object" do
115
- setup do
116
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => @parent )
117
- end
118
-
119
- should "resolve index path" do
120
- assert_equal 'parent_things_path', @path_helpers[:index_rest_helper]
121
- end
122
-
123
- should "resolve index args" do
124
- assert_equal [@parent], @path_helpers[:index_rest_args]
125
- end
126
-
127
- should "resolve show path" do
128
- assert_equal 'parent_thing_path', @path_helpers[:show_rest_helper]
129
- end
130
-
131
- should "resolve show args" do
132
- assert_equal [@parent], @path_helpers[:show_rest_args]
133
- end
134
-
135
- should "resolve new path" do
136
- assert_equal 'new_parent_thing_path', @path_helpers[:new_rest_helper]
137
- end
138
-
139
- should "resolve new args" do
140
- assert_equal [@parent], @path_helpers[:new_rest_args]
141
- end
142
-
143
- should "resolve edit path" do
144
- assert_equal 'edit_parent_thing_path', @path_helpers[:edit_rest_helper]
145
- end
146
-
147
- should "resolve edit args" do
148
- assert_equal [@parent], @path_helpers[:edit_rest_args]
149
- end
150
-
151
- should "resolve delete path" do
152
- assert_equal 'delete_parent_thing_path', @path_helpers[:delete_rest_helper]
153
- end
154
-
155
- should "resolve delete args" do
156
- assert_equal [@parent], @path_helpers[:delete_rest_args]
157
- end
158
- end
159
-
160
- context "nested REST paths given ActiveRecord object and scoped by single object array" do
161
- setup do
162
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@parent] )
163
- end
164
-
165
- should "resolve index path" do
166
- assert_equal 'parent_things_path', @path_helpers[:index_rest_helper]
167
- end
168
-
169
- should "resolve index args" do
170
- assert_equal [@parent], @path_helpers[:index_rest_args]
171
- end
172
-
173
- should "resolve show path" do
174
- assert_equal 'parent_thing_path', @path_helpers[:show_rest_helper]
175
- end
176
-
177
- should "resolve show args" do
178
- assert_equal [@parent], @path_helpers[:show_rest_args]
179
- end
180
-
181
- should "resolve new path" do
182
- assert_equal 'new_parent_thing_path', @path_helpers[:new_rest_helper]
183
- end
184
-
185
- should "resolve new args" do
186
- assert_equal [@parent], @path_helpers[:new_rest_args]
187
- end
188
-
189
- should "resolve edit path" do
190
- assert_equal 'edit_parent_thing_path', @path_helpers[:edit_rest_helper]
191
- end
192
-
193
- should "resolve edit args" do
194
- assert_equal [@parent], @path_helpers[:edit_rest_args]
195
- end
196
-
197
- should "resolve delete path" do
198
- assert_equal 'delete_parent_thing_path', @path_helpers[:delete_rest_helper]
199
- end
200
-
201
- should "resolve delete args" do
202
- assert_equal [@parent], @path_helpers[:delete_rest_args]
203
- end
204
- end
205
-
206
- context "nested REST paths given ActiveRecord collection and scoped by single object array" do
207
- setup do
208
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@parent] )
209
- end
210
-
211
- should "resolve index path" do
212
- assert_equal 'parent_things_path', @path_helpers[:index_rest_helper]
213
- end
214
-
215
- should "resolve index args" do
216
- assert_equal [@parent], @path_helpers[:index_rest_args]
217
- end
218
-
219
- should "resolve show path" do
220
- assert_equal 'parent_thing_path', @path_helpers[:show_rest_helper]
221
- end
222
-
223
- should "resolve show args" do
224
- assert_equal [@parent], @path_helpers[:show_rest_args]
225
- end
226
-
227
- should "resolve new path" do
228
- assert_equal 'new_parent_thing_path', @path_helpers[:new_rest_helper]
229
- end
230
-
231
- should "resolve new args" do
232
- assert_equal [@parent], @path_helpers[:new_rest_args]
233
- end
234
-
235
- should "resolve edit path" do
236
- assert_equal 'edit_parent_thing_path', @path_helpers[:edit_rest_helper]
237
- end
238
-
239
- should "resolve edit args" do
240
- assert_equal [@parent], @path_helpers[:edit_rest_args]
241
- end
242
-
243
- should "resolve delete path" do
244
- assert_equal 'delete_parent_thing_path', @path_helpers[:delete_rest_helper]
245
- end
246
-
247
- should "resolve delete args" do
248
- assert_equal [@parent], @path_helpers[:delete_rest_args]
249
- end
250
- end
251
-
252
- context "nested REST paths given ActiveRecord object and scoped by multiple object array" do
253
- setup do
254
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@owner, @parent] )
255
- end
256
-
257
- should "resolve index path" do
258
- assert_equal 'owner_parent_things_path', @path_helpers[:index_rest_helper]
259
- end
260
-
261
- should "resolve index args" do
262
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
263
- end
264
-
265
- should "resolve show path" do
266
- assert_equal 'owner_parent_thing_path', @path_helpers[:show_rest_helper]
267
- end
268
-
269
- should "resolve show args" do
270
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
271
- end
272
-
273
- should "resolve new path" do
274
- assert_equal 'new_owner_parent_thing_path', @path_helpers[:new_rest_helper]
275
- end
276
-
277
- should "resolve new args" do
278
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
279
- end
280
-
281
- should "resolve edit path" do
282
- assert_equal 'edit_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
283
- end
284
-
285
- should "resolve edit args" do
286
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
287
- end
288
-
289
- should "resolve delete path" do
290
- assert_equal 'delete_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
291
- end
292
-
293
- should "resolve delete args" do
294
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
295
- end
296
- end
297
-
298
- context "nested REST paths given ActiveRecord collection and scoped by multiple object array" do
299
- setup do
300
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@owner, @parent] )
301
- end
302
-
303
- should "resolve index path" do
304
- assert_equal 'owner_parent_things_path', @path_helpers[:index_rest_helper]
305
- end
306
-
307
- should "resolve index args" do
308
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
309
- end
310
-
311
- should "resolve show path" do
312
- assert_equal 'owner_parent_thing_path', @path_helpers[:show_rest_helper]
313
- end
314
-
315
- should "resolve show args" do
316
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
317
- end
318
-
319
- should "resolve new path" do
320
- assert_equal 'new_owner_parent_thing_path', @path_helpers[:new_rest_helper]
321
- end
322
-
323
- should "resolve new args" do
324
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
325
- end
326
-
327
- should "resolve edit path" do
328
- assert_equal 'edit_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
329
- end
330
-
331
- should "resolve edit args" do
332
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
333
- end
334
-
335
- should "resolve delete path" do
336
- assert_equal 'delete_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
337
- end
338
-
339
- should "resolve delete args" do
340
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
341
- end
342
- end
343
-
344
- context "single level REST paths given ActiveRecord object and namespace symbol" do
345
- setup do
346
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :namespace => :admin )
347
- end
348
-
349
- should "resolve index path" do
350
- assert_equal 'admin_things_path', @path_helpers[:index_rest_helper]
351
- end
352
-
353
- should "resolve index args" do
354
- assert_equal [], @path_helpers[:index_rest_args]
355
- end
356
-
357
- should "resolve show path" do
358
- assert_equal 'admin_thing_path', @path_helpers[:show_rest_helper]
359
- end
360
-
361
- should "resolve show args" do
362
- assert_equal [], @path_helpers[:show_rest_args]
363
- end
364
-
365
- should "resolve new path" do
366
- assert_equal 'new_admin_thing_path', @path_helpers[:new_rest_helper]
367
- end
368
-
369
- should "resolve new args" do
370
- assert_equal [], @path_helpers[:new_rest_args]
371
- end
372
-
373
- should "resolve edit path" do
374
- assert_equal 'edit_admin_thing_path', @path_helpers[:edit_rest_helper]
375
- end
376
-
377
- should "resolve edit args" do
378
- assert_equal [], @path_helpers[:edit_rest_args]
379
- end
380
-
381
- should "resolve delete path" do
382
- assert_equal 'delete_admin_thing_path', @path_helpers[:delete_rest_helper]
383
- end
384
-
385
- should "resolve delete args" do
386
- assert_equal [], @path_helpers[:delete_rest_args]
387
- end
388
- end
389
-
390
- context "single level REST paths given ActiveRecord object and namespace string" do
391
- setup do
392
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :namespace => 'admin' )
393
- end
394
-
395
- should "resolve index path" do
396
- assert_equal 'admin_things_path', @path_helpers[:index_rest_helper]
397
- end
398
-
399
- should "resolve index args" do
400
- assert_equal [], @path_helpers[:index_rest_args]
401
- end
402
-
403
- should "resolve show path" do
404
- assert_equal 'admin_thing_path', @path_helpers[:show_rest_helper]
405
- end
406
-
407
- should "resolve show args" do
408
- assert_equal [], @path_helpers[:show_rest_args]
409
- end
410
-
411
- should "resolve new path" do
412
- assert_equal 'new_admin_thing_path', @path_helpers[:new_rest_helper]
413
- end
414
-
415
- should "resolve new args" do
416
- assert_equal [], @path_helpers[:new_rest_args]
417
- end
418
-
419
- should "resolve edit path" do
420
- assert_equal 'edit_admin_thing_path', @path_helpers[:edit_rest_helper]
421
- end
422
-
423
- should "resolve edit args" do
424
- assert_equal [], @path_helpers[:edit_rest_args]
425
- end
426
-
427
- should "resolve delete path" do
428
- assert_equal 'delete_admin_thing_path', @path_helpers[:delete_rest_helper]
429
- end
430
-
431
- should "resolve delete args" do
432
- assert_equal [], @path_helpers[:delete_rest_args]
433
- end
434
- end
435
-
436
- context "single level REST paths given ActiveRecord collection and namespace symbol" do
437
- setup do
438
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :namespace => :admin )
439
- end
440
-
441
- should "resolve index path" do
442
- assert_equal 'admin_things_path', @path_helpers[:index_rest_helper]
443
- end
444
-
445
- should "resolve index args" do
446
- assert_equal [], @path_helpers[:index_rest_args]
447
- end
448
-
449
- should "resolve show path" do
450
- assert_equal 'admin_thing_path', @path_helpers[:show_rest_helper]
451
- end
452
-
453
- should "resolve show args" do
454
- assert_equal [], @path_helpers[:show_rest_args]
455
- end
456
-
457
- should "resolve new path" do
458
- assert_equal 'new_admin_thing_path', @path_helpers[:new_rest_helper]
459
- end
460
-
461
- should "resolve new args" do
462
- assert_equal [], @path_helpers[:new_rest_args]
463
- end
464
-
465
- should "resolve edit path" do
466
- assert_equal 'edit_admin_thing_path', @path_helpers[:edit_rest_helper]
467
- end
468
-
469
- should "resolve edit args" do
470
- assert_equal [], @path_helpers[:edit_rest_args]
471
- end
472
-
473
- should "resolve delete path" do
474
- assert_equal 'delete_admin_thing_path', @path_helpers[:delete_rest_helper]
475
- end
476
-
477
- should "resolve delete args" do
478
- assert_equal [], @path_helpers[:delete_rest_args]
479
- end
480
- end
481
-
482
- context "single level REST paths given ActiveRecord collection and namespace string" do
483
- setup do
484
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :namespace => 'admin' )
485
- end
486
-
487
- should "resolve index path" do
488
- assert_equal 'admin_things_path', @path_helpers[:index_rest_helper]
489
- end
490
-
491
- should "resolve index args" do
492
- assert_equal [], @path_helpers[:index_rest_args]
493
- end
494
-
495
- should "resolve show path" do
496
- assert_equal 'admin_thing_path', @path_helpers[:show_rest_helper]
497
- end
498
-
499
- should "resolve show args" do
500
- assert_equal [], @path_helpers[:show_rest_args]
501
- end
502
-
503
- should "resolve new path" do
504
- assert_equal 'new_admin_thing_path', @path_helpers[:new_rest_helper]
505
- end
506
-
507
- should "resolve new args" do
508
- assert_equal [], @path_helpers[:new_rest_args]
509
- end
510
-
511
- should "resolve edit path" do
512
- assert_equal 'edit_admin_thing_path', @path_helpers[:edit_rest_helper]
513
- end
514
-
515
- should "resolve edit args" do
516
- assert_equal [], @path_helpers[:edit_rest_args]
517
- end
518
-
519
- should "resolve delete path" do
520
- assert_equal 'delete_admin_thing_path', @path_helpers[:delete_rest_helper]
521
- end
522
-
523
- should "resolve delete args" do
524
- assert_equal [], @path_helpers[:delete_rest_args]
525
- end
526
- end
527
-
528
- context "nested REST paths given ActiveRecord object and scoped by single object and namespace symbol" do
529
- setup do
530
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => @parent, :namespace => :admin )
531
- end
532
-
533
- should "resolve index path" do
534
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
535
- end
536
-
537
- should "resolve index args" do
538
- assert_equal [@parent], @path_helpers[:index_rest_args]
539
- end
540
-
541
- should "resolve show path" do
542
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
543
- end
544
-
545
- should "resolve show args" do
546
- assert_equal [@parent], @path_helpers[:show_rest_args]
547
- end
548
-
549
- should "resolve new path" do
550
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
551
- end
552
-
553
- should "resolve new args" do
554
- assert_equal [@parent], @path_helpers[:new_rest_args]
555
- end
556
-
557
- should "resolve edit path" do
558
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
559
- end
560
-
561
- should "resolve edit args" do
562
- assert_equal [@parent], @path_helpers[:edit_rest_args]
563
- end
564
-
565
- should "resolve delete path" do
566
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
567
- end
568
-
569
- should "resolve delete args" do
570
- assert_equal [@parent], @path_helpers[:delete_rest_args]
571
- end
572
- end
573
-
574
- context "nested REST paths given ActiveRecord object and scoped by single object and namespace string" do
575
- setup do
576
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => @parent, :namespace => 'admin' )
577
- end
578
-
579
- should "resolve index path" do
580
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
581
- end
582
-
583
- should "resolve index args" do
584
- assert_equal [@parent], @path_helpers[:index_rest_args]
585
- end
586
-
587
- should "resolve show path" do
588
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
589
- end
590
-
591
- should "resolve show args" do
592
- assert_equal [@parent], @path_helpers[:show_rest_args]
593
- end
594
-
595
- should "resolve new path" do
596
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
597
- end
598
-
599
- should "resolve new args" do
600
- assert_equal [@parent], @path_helpers[:new_rest_args]
601
- end
602
-
603
- should "resolve edit path" do
604
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
605
- end
606
-
607
- should "resolve edit args" do
608
- assert_equal [@parent], @path_helpers[:edit_rest_args]
609
- end
610
-
611
- should "resolve delete path" do
612
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
613
- end
614
-
615
- should "resolve delete args" do
616
- assert_equal [@parent], @path_helpers[:delete_rest_args]
617
- end
618
- end
619
-
620
- context "nested REST paths given ActiveRecord collection and scoped by single object and namespace symbol" do
621
- setup do
622
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => @parent, :namespace => :admin )
623
- end
624
-
625
- should "resolve index path" do
626
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
627
- end
628
-
629
- should "resolve index args" do
630
- assert_equal [@parent], @path_helpers[:index_rest_args]
631
- end
632
-
633
- should "resolve show path" do
634
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
635
- end
636
-
637
- should "resolve show args" do
638
- assert_equal [@parent], @path_helpers[:show_rest_args]
639
- end
640
-
641
- should "resolve new path" do
642
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
643
- end
644
-
645
- should "resolve new args" do
646
- assert_equal [@parent], @path_helpers[:new_rest_args]
647
- end
648
-
649
- should "resolve edit path" do
650
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
651
- end
652
-
653
- should "resolve edit args" do
654
- assert_equal [@parent], @path_helpers[:edit_rest_args]
655
- end
656
-
657
- should "resolve delete path" do
658
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
659
- end
660
-
661
- should "resolve delete args" do
662
- assert_equal [@parent], @path_helpers[:delete_rest_args]
663
- end
664
- end
665
-
666
- context "nested REST paths given ActiveRecord collection and scoped by single object and namespace string" do
667
- setup do
668
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => @parent, :namespace => 'admin' )
669
- end
670
-
671
- should "resolve index path" do
672
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
673
- end
674
-
675
- should "resolve index args" do
676
- assert_equal [@parent], @path_helpers[:index_rest_args]
677
- end
678
-
679
- should "resolve show path" do
680
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
681
- end
682
-
683
- should "resolve show args" do
684
- assert_equal [@parent], @path_helpers[:show_rest_args]
685
- end
686
-
687
- should "resolve new path" do
688
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
689
- end
690
-
691
- should "resolve new args" do
692
- assert_equal [@parent], @path_helpers[:new_rest_args]
693
- end
694
-
695
- should "resolve edit path" do
696
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
697
- end
698
-
699
- should "resolve edit args" do
700
- assert_equal [@parent], @path_helpers[:edit_rest_args]
701
- end
702
-
703
- should "resolve delete path" do
704
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
705
- end
706
-
707
- should "resolve delete args" do
708
- assert_equal [@parent], @path_helpers[:delete_rest_args]
709
- end
710
- end
711
-
712
- context "nested REST paths given ActiveRecord object and scoped by single object array and namespace symbol" do
713
- setup do
714
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@parent], :namespace => :admin )
715
- end
716
-
717
- should "resolve index path" do
718
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
719
- end
720
-
721
- should "resolve index args" do
722
- assert_equal [@parent], @path_helpers[:index_rest_args]
723
- end
724
-
725
- should "resolve show path" do
726
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
727
- end
728
-
729
- should "resolve show args" do
730
- assert_equal [@parent], @path_helpers[:show_rest_args]
731
- end
732
-
733
- should "resolve new path" do
734
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
735
- end
736
-
737
- should "resolve new args" do
738
- assert_equal [@parent], @path_helpers[:new_rest_args]
739
- end
740
-
741
- should "resolve edit path" do
742
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
743
- end
744
-
745
- should "resolve edit args" do
746
- assert_equal [@parent], @path_helpers[:edit_rest_args]
747
- end
748
-
749
- should "resolve delete path" do
750
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
751
- end
752
-
753
- should "resolve delete args" do
754
- assert_equal [@parent], @path_helpers[:delete_rest_args]
755
- end
756
- end
757
-
758
- context "nested REST paths given ActiveRecord object and scoped by single object array and namespace string" do
759
- setup do
760
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@parent], :namespace => 'admin' )
761
- end
762
-
763
- should "resolve index path" do
764
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
765
- end
766
-
767
- should "resolve index args" do
768
- assert_equal [@parent], @path_helpers[:index_rest_args]
769
- end
770
-
771
- should "resolve show path" do
772
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
773
- end
774
-
775
- should "resolve show args" do
776
- assert_equal [@parent], @path_helpers[:show_rest_args]
777
- end
778
-
779
- should "resolve new path" do
780
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
781
- end
782
-
783
- should "resolve new args" do
784
- assert_equal [@parent], @path_helpers[:new_rest_args]
785
- end
786
-
787
- should "resolve edit path" do
788
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
789
- end
790
-
791
- should "resolve edit args" do
792
- assert_equal [@parent], @path_helpers[:edit_rest_args]
793
- end
794
-
795
- should "resolve delete path" do
796
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
797
- end
798
-
799
- should "resolve delete args" do
800
- assert_equal [@parent], @path_helpers[:delete_rest_args]
801
- end
802
- end
803
-
804
- context "nested REST paths given ActiveRecord collection and scoped by single object array and namespace symbol" do
805
- setup do
806
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@parent], :namespace => :admin )
807
- end
808
-
809
- should "resolve index path" do
810
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
811
- end
812
-
813
- should "resolve index args" do
814
- assert_equal [@parent], @path_helpers[:index_rest_args]
815
- end
816
-
817
- should "resolve show path" do
818
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
819
- end
820
-
821
- should "resolve show args" do
822
- assert_equal [@parent], @path_helpers[:show_rest_args]
823
- end
824
-
825
- should "resolve new path" do
826
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
827
- end
828
-
829
- should "resolve new args" do
830
- assert_equal [@parent], @path_helpers[:new_rest_args]
831
- end
832
-
833
- should "resolve edit path" do
834
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
835
- end
836
-
837
- should "resolve edit args" do
838
- assert_equal [@parent], @path_helpers[:edit_rest_args]
839
- end
840
-
841
- should "resolve delete path" do
842
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
843
- end
844
-
845
- should "resolve delete args" do
846
- assert_equal [@parent], @path_helpers[:delete_rest_args]
847
- end
848
- end
849
-
850
- context "nested REST paths given ActiveRecord collection and scoped by single object array and namespace string" do
851
- setup do
852
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@parent], :namespace => 'admin' )
853
- end
854
-
855
- should "resolve index path" do
856
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
857
- end
858
-
859
- should "resolve index args" do
860
- assert_equal [@parent], @path_helpers[:index_rest_args]
861
- end
862
-
863
- should "resolve show path" do
864
- assert_equal 'admin_parent_thing_path', @path_helpers[:show_rest_helper]
865
- end
866
-
867
- should "resolve show args" do
868
- assert_equal [@parent], @path_helpers[:show_rest_args]
869
- end
870
-
871
- should "resolve new path" do
872
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
873
- end
874
-
875
- should "resolve new args" do
876
- assert_equal [@parent], @path_helpers[:new_rest_args]
877
- end
878
-
879
- should "resolve edit path" do
880
- assert_equal 'edit_admin_parent_thing_path', @path_helpers[:edit_rest_helper]
881
- end
882
-
883
- should "resolve edit args" do
884
- assert_equal [@parent], @path_helpers[:edit_rest_args]
885
- end
886
-
887
- should "resolve delete path" do
888
- assert_equal 'delete_admin_parent_thing_path', @path_helpers[:delete_rest_helper]
889
- end
890
-
891
- should "resolve delete args" do
892
- assert_equal [@parent], @path_helpers[:delete_rest_args]
893
- end
894
- end
895
-
896
- context "nested REST paths given ActiveRecord object and scoped by multiple object array and namespace symbol" do
897
- setup do
898
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@owner, @parent], :namespace => :admin )
899
- end
900
-
901
- should "resolve index path" do
902
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
903
- end
904
-
905
- should "resolve index args" do
906
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
907
- end
908
-
909
- should "resolve show path" do
910
- assert_equal 'admin_owner_parent_thing_path', @path_helpers[:show_rest_helper]
911
- end
912
-
913
- should "resolve show args" do
914
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
915
- end
916
-
917
- should "resolve new path" do
918
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
919
- end
920
-
921
- should "resolve new args" do
922
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
923
- end
924
-
925
- should "resolve edit path" do
926
- assert_equal 'edit_admin_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
927
- end
928
-
929
- should "resolve edit args" do
930
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
931
- end
932
-
933
- should "resolve delete path" do
934
- assert_equal 'delete_admin_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
935
- end
936
-
937
- should "resolve delete args" do
938
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
939
- end
940
- end
941
-
942
- context "nested REST paths given ActiveRecord object and scoped by multiple object array and namespace string" do
943
- setup do
944
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@owner, @parent], :namespace => 'admin' )
945
- end
946
-
947
- should "resolve index path" do
948
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
949
- end
950
-
951
- should "resolve index args" do
952
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
953
- end
954
-
955
- should "resolve show path" do
956
- assert_equal 'admin_owner_parent_thing_path', @path_helpers[:show_rest_helper]
957
- end
958
-
959
- should "resolve show args" do
960
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
961
- end
962
-
963
- should "resolve new path" do
964
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
965
- end
966
-
967
- should "resolve new args" do
968
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
969
- end
970
-
971
- should "resolve edit path" do
972
- assert_equal 'edit_admin_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
973
- end
974
-
975
- should "resolve edit args" do
976
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
977
- end
978
-
979
- should "resolve delete path" do
980
- assert_equal 'delete_admin_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
981
- end
982
-
983
- should "resolve delete args" do
984
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
985
- end
986
- end
987
-
988
- context "nested REST paths given ActiveRecord collection and scoped by multiple object array and namespace symbol" do
989
- setup do
990
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@owner, @parent], :namespace => :admin )
991
- end
992
-
993
- should "resolve index path" do
994
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
995
- end
996
-
997
- should "resolve index args" do
998
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
999
- end
1000
-
1001
- should "resolve show path" do
1002
- assert_equal 'admin_owner_parent_thing_path', @path_helpers[:show_rest_helper]
1003
- end
1004
-
1005
- should "resolve show args" do
1006
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
1007
- end
1008
-
1009
- should "resolve new path" do
1010
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1011
- end
1012
-
1013
- should "resolve new args" do
1014
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1015
- end
1016
-
1017
- should "resolve edit path" do
1018
- assert_equal 'edit_admin_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
1019
- end
1020
-
1021
- should "resolve edit args" do
1022
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
1023
- end
1024
-
1025
- should "resolve delete path" do
1026
- assert_equal 'delete_admin_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
1027
- end
1028
-
1029
- should "resolve delete args" do
1030
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
1031
- end
1032
- end
1033
-
1034
- context "nested REST paths given ActiveRecord collection and scoped by multiple object array and namespace string" do
1035
- setup do
1036
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@owner, @parent], :namespace => 'admin' )
1037
- end
1038
-
1039
- should "resolve index path" do
1040
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
1041
- end
1042
-
1043
- should "resolve index args" do
1044
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
1045
- end
1046
-
1047
- should "resolve show path" do
1048
- assert_equal 'admin_owner_parent_thing_path', @path_helpers[:show_rest_helper]
1049
- end
1050
-
1051
- should "resolve show args" do
1052
- assert_equal [@owner, @parent], @path_helpers[:show_rest_args]
1053
- end
1054
-
1055
- should "resolve new path" do
1056
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1057
- end
1058
-
1059
- should "resolve new args" do
1060
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1061
- end
1062
-
1063
- should "resolve edit path" do
1064
- assert_equal 'edit_admin_owner_parent_thing_path', @path_helpers[:edit_rest_helper]
1065
- end
1066
-
1067
- should "resolve edit args" do
1068
- assert_equal [@owner, @parent], @path_helpers[:edit_rest_args]
1069
- end
1070
-
1071
- should "resolve delete path" do
1072
- assert_equal 'delete_admin_owner_parent_thing_path', @path_helpers[:delete_rest_helper]
1073
- end
1074
-
1075
- should "resolve delete args" do
1076
- assert_equal [@owner, @parent], @path_helpers[:delete_rest_args]
1077
- end
1078
- end
1079
-
1080
- context "shallow nested REST paths given ActiveRecord object and scoped by single object" do
1081
- setup do
1082
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => @parent, :shallow => true )
1083
- end
1084
-
1085
- should "resolve index path" do
1086
- assert_equal 'parent_things_path', @path_helpers[:index_rest_helper]
1087
- end
1088
-
1089
- should "resolve index args" do
1090
- assert_equal [@parent], @path_helpers[:index_rest_args]
1091
- end
1092
-
1093
- should "resolve show path" do
1094
- assert_equal 'thing_path', @path_helpers[:show_rest_helper]
1095
- end
1096
-
1097
- should "resolve show args" do
1098
- assert_equal [], @path_helpers[:show_rest_args]
1099
- end
1100
-
1101
- should "resolve new path" do
1102
- assert_equal 'new_parent_thing_path', @path_helpers[:new_rest_helper]
1103
- end
1104
-
1105
- should "resolve new args" do
1106
- assert_equal [@parent], @path_helpers[:new_rest_args]
1107
- end
1108
-
1109
- should "resolve edit path" do
1110
- assert_equal 'edit_thing_path', @path_helpers[:edit_rest_helper]
1111
- end
1112
-
1113
- should "resolve edit args" do
1114
- assert_equal [], @path_helpers[:edit_rest_args]
1115
- end
1116
-
1117
- should "resolve delete path" do
1118
- assert_equal 'delete_thing_path', @path_helpers[:delete_rest_helper]
1119
- end
1120
-
1121
- should "resolve delete args" do
1122
- assert_equal [], @path_helpers[:delete_rest_args]
1123
- end
1124
- end
1125
-
1126
- context "shallow nested REST paths given ActiveRecord collection and scoped by single object" do
1127
- setup do
1128
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => @parent, :shallow => true )
1129
- end
1130
-
1131
- should "resolve index path" do
1132
- assert_equal 'parent_things_path', @path_helpers[:index_rest_helper]
1133
- end
1134
-
1135
- should "resolve index args" do
1136
- assert_equal [@parent], @path_helpers[:index_rest_args]
1137
- end
1138
-
1139
- should "resolve show path" do
1140
- assert_equal 'thing_path', @path_helpers[:show_rest_helper]
1141
- end
1142
-
1143
- should "resolve show args" do
1144
- assert_equal [], @path_helpers[:show_rest_args]
1145
- end
1146
-
1147
- should "resolve new path" do
1148
- assert_equal 'new_parent_thing_path', @path_helpers[:new_rest_helper]
1149
- end
1150
-
1151
- should "resolve new args" do
1152
- assert_equal [@parent], @path_helpers[:new_rest_args]
1153
- end
1154
-
1155
- should "resolve edit path" do
1156
- assert_equal 'edit_thing_path', @path_helpers[:edit_rest_helper]
1157
- end
1158
-
1159
- should "resolve edit args" do
1160
- assert_equal [], @path_helpers[:edit_rest_args]
1161
- end
1162
-
1163
- should "resolve delete path" do
1164
- assert_equal 'delete_thing_path', @path_helpers[:delete_rest_helper]
1165
- end
1166
-
1167
- should "resolve delete args" do
1168
- assert_equal [], @path_helpers[:delete_rest_args]
1169
- end
1170
- end
1171
-
1172
- context "shallow nested REST paths given ActiveRecord object and scoped by multiple object array" do
1173
- setup do
1174
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@owner, @parent], :shallow => true )
1175
- end
1176
-
1177
- should "resolve index path" do
1178
- assert_equal 'owner_parent_things_path', @path_helpers[:index_rest_helper]
1179
- end
1180
-
1181
- should "resolve index args" do
1182
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
1183
- end
1184
-
1185
- should "resolve show path" do
1186
- assert_equal 'owner_thing_path', @path_helpers[:show_rest_helper]
1187
- end
1188
-
1189
- should "resolve show args" do
1190
- assert_equal [@owner], @path_helpers[:show_rest_args]
1191
- end
1192
-
1193
- should "resolve new path" do
1194
- assert_equal 'new_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1195
- end
1196
-
1197
- should "resolve new args" do
1198
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1199
- end
1200
-
1201
- should "resolve edit path" do
1202
- assert_equal 'edit_owner_thing_path', @path_helpers[:edit_rest_helper]
1203
- end
1204
-
1205
- should "resolve edit args" do
1206
- assert_equal [@owner], @path_helpers[:edit_rest_args]
1207
- end
1208
-
1209
- should "resolve delete path" do
1210
- assert_equal 'delete_owner_thing_path', @path_helpers[:delete_rest_helper]
1211
- end
1212
-
1213
- should "resolve delete args" do
1214
- assert_equal [@owner], @path_helpers[:delete_rest_args]
1215
- end
1216
- end
1217
-
1218
- context "shallow nested REST paths given ActiveRecord collection and scoped by multiple object array" do
1219
- setup do
1220
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @things, :scoped_by => [@owner, @parent], :shallow => true )
1221
- end
1222
-
1223
- should "resolve index path" do
1224
- assert_equal 'owner_parent_things_path', @path_helpers[:index_rest_helper]
1225
- end
1226
-
1227
- should "resolve index args" do
1228
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
1229
- end
1230
-
1231
- should "resolve show path" do
1232
- assert_equal 'owner_thing_path', @path_helpers[:show_rest_helper]
1233
- end
1234
-
1235
- should "resolve show args" do
1236
- assert_equal [@owner], @path_helpers[:show_rest_args]
1237
- end
1238
-
1239
- should "resolve new path" do
1240
- assert_equal 'new_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1241
- end
1242
-
1243
- should "resolve new args" do
1244
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1245
- end
1246
-
1247
- should "resolve edit path" do
1248
- assert_equal 'edit_owner_thing_path', @path_helpers[:edit_rest_helper]
1249
- end
1250
-
1251
- should "resolve edit args" do
1252
- assert_equal [@owner], @path_helpers[:edit_rest_args]
1253
- end
1254
-
1255
- should "resolve delete path" do
1256
- assert_equal 'delete_owner_thing_path', @path_helpers[:delete_rest_helper]
1257
- end
1258
-
1259
- should "resolve delete args" do
1260
- assert_equal [@owner], @path_helpers[:delete_rest_args]
1261
- end
1262
- end
1263
-
1264
- context "shallow nested REST paths given ActiveRecord object and scoped by single object and namespace symbol" do
1265
- setup do
1266
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => @parent, :namespace => :admin, :shallow => true )
1267
- end
1268
-
1269
- should "resolve index path" do
1270
- assert_equal 'admin_parent_things_path', @path_helpers[:index_rest_helper]
1271
- end
1272
-
1273
- should "resolve index args" do
1274
- assert_equal [@parent], @path_helpers[:index_rest_args]
1275
- end
1276
-
1277
- should "resolve show path" do
1278
- assert_equal 'admin_thing_path', @path_helpers[:show_rest_helper]
1279
- end
1280
-
1281
- should "resolve show args" do
1282
- assert_equal [], @path_helpers[:show_rest_args]
1283
- end
1284
-
1285
- should "resolve new path" do
1286
- assert_equal 'new_admin_parent_thing_path', @path_helpers[:new_rest_helper]
1287
- end
1288
-
1289
- should "resolve new args" do
1290
- assert_equal [@parent], @path_helpers[:new_rest_args]
1291
- end
1292
-
1293
- should "resolve edit path" do
1294
- assert_equal 'edit_admin_thing_path', @path_helpers[:edit_rest_helper]
1295
- end
1296
-
1297
- should "resolve edit args" do
1298
- assert_equal [], @path_helpers[:edit_rest_args]
1299
- end
1300
-
1301
- should "resolve delete path" do
1302
- assert_equal 'delete_admin_thing_path', @path_helpers[:delete_rest_helper]
1303
- end
1304
-
1305
- should "resolve delete args" do
1306
- assert_equal [], @path_helpers[:delete_rest_args]
1307
- end
1308
- end
1309
-
1310
- context "shallow nested REST paths given ActiveRecord object and scoped by multiple object array and namespace symbol" do
1311
- setup do
1312
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @thing, :scoped_by => [@owner, @parent], :namespace => :admin,
1313
- :shallow => true )
1314
- end
1315
-
1316
- should "resolve index path" do
1317
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
1318
- end
1319
-
1320
- should "resolve index args" do
1321
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
1322
- end
1323
-
1324
- should "resolve show path" do
1325
- assert_equal 'admin_owner_thing_path', @path_helpers[:show_rest_helper]
1326
- end
1327
-
1328
- should "resolve show args" do
1329
- assert_equal [@owner], @path_helpers[:show_rest_args]
1330
- end
1331
-
1332
- should "resolve new path" do
1333
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1334
- end
1335
-
1336
- should "resolve new args" do
1337
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1338
- end
1339
-
1340
- should "resolve edit path" do
1341
- assert_equal 'edit_admin_owner_thing_path', @path_helpers[:edit_rest_helper]
1342
- end
1343
-
1344
- should "resolve edit args" do
1345
- assert_equal [@owner], @path_helpers[:edit_rest_args]
1346
- end
1347
-
1348
- should "resolve delete path" do
1349
- assert_equal 'delete_admin_owner_thing_path', @path_helpers[:delete_rest_helper]
1350
- end
1351
-
1352
- should "resolve delete args" do
1353
- assert_equal [@owner], @path_helpers[:delete_rest_args]
1354
- end
1355
- end
1356
-
1357
- context "single level REST paths given a polymorphic ActiveRecord object" do
1358
- setup do
1359
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @lookup, :polymorphic_type => 'Thing', :polymorphic_as => :lookupable )
1360
- end
1361
-
1362
- should "resolve index path" do
1363
- assert_equal 'things_path', @path_helpers[:index_rest_helper]
1364
- end
1365
-
1366
- should "resolve index args" do
1367
- assert_equal [], @path_helpers[:index_rest_args]
1368
- end
1369
-
1370
- should "resolve show path" do
1371
- assert_equal 'thing_path', @path_helpers[:show_rest_helper]
1372
- end
1373
-
1374
- should "resolve show args" do
1375
- assert_equal [], @path_helpers[:show_rest_args]
1376
- end
1377
-
1378
- should "resolve new path" do
1379
- assert_equal 'new_thing_path', @path_helpers[:new_rest_helper]
1380
- end
1381
-
1382
- should "resolve new args" do
1383
- assert_equal [], @path_helpers[:new_rest_args]
1384
- end
1385
-
1386
- should "resolve edit path" do
1387
- assert_equal 'edit_thing_path', @path_helpers[:edit_rest_helper]
1388
- end
1389
-
1390
- should "resolve edit args" do
1391
- assert_equal [], @path_helpers[:edit_rest_args]
1392
- end
1393
-
1394
- should "resolve delete path" do
1395
- assert_equal 'delete_thing_path', @path_helpers[:delete_rest_helper]
1396
- end
1397
-
1398
- should "resolve delete args" do
1399
- assert_equal [], @path_helpers[:delete_rest_args]
1400
- end
1401
- end
1402
-
1403
- context "shallow nested REST paths given a polymorphic ActiveRecord object and scoped by multiple object array and namespace symbol" do
1404
- setup do
1405
- @path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( @looku, :scoped_by => [@owner, @parent], :namespace => :admin,
1406
- :shallow => true, :polymorphic_type => 'Thing', :polymorphic_as => :lookupable )
1407
- end
1408
-
1409
- should "resolve index path" do
1410
- assert_equal 'admin_owner_parent_things_path', @path_helpers[:index_rest_helper]
1411
- end
1412
-
1413
- should "resolve index args" do
1414
- assert_equal [@owner, @parent], @path_helpers[:index_rest_args]
1415
- end
1416
-
1417
- should "resolve show path" do
1418
- assert_equal 'admin_owner_thing_path', @path_helpers[:show_rest_helper]
1419
- end
1420
-
1421
- should "resolve show args" do
1422
- assert_equal [@owner], @path_helpers[:show_rest_args]
1423
- end
1424
-
1425
- should "resolve new path" do
1426
- assert_equal 'new_admin_owner_parent_thing_path', @path_helpers[:new_rest_helper]
1427
- end
1428
-
1429
- should "resolve new args" do
1430
- assert_equal [@owner, @parent], @path_helpers[:new_rest_args]
1431
- end
1432
-
1433
- should "resolve edit path" do
1434
- assert_equal 'edit_admin_owner_thing_path', @path_helpers[:edit_rest_helper]
1435
- end
1436
-
1437
- should "resolve edit args" do
1438
- assert_equal [@owner], @path_helpers[:edit_rest_args]
1439
- end
1440
-
1441
- should "resolve delete path" do
1442
- assert_equal 'delete_admin_owner_thing_path', @path_helpers[:delete_rest_helper]
1443
- end
1444
-
1445
- should "resolve delete args" do
1446
- assert_equal [@owner], @path_helpers[:delete_rest_args]
1447
- end
1448
- end
1449
- end
1450
- end