public
Description: resources_controller rails plugin: rc makes RESTful controllers fun
Homepage: http://plugins.ardes.com/doc/resources_controller
Clone URL: git://github.com/ianwhite/resources_controller.git
Click here to lend your support to: resources_controller and make a donation at www.pledgie.com !
100644 957 lines (794 sloc) 37.355 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
 
Routing shortcuts for Account should map
- resource_path to /account
- resource_info_tags_path to /account/info/tags
 
AccountsController#resource_service
- .new should call :new on User
- .find should call :current_user
- .find should call whatever is in resource_specification @find
- .find should raise CantFindSingleton when no custom finder (and no enclosing resource)
- .foo should call foo on User
- .respond_to?(:foo) should call respond_to?(:foo) on User
 
Routing shortcuts for Addresses (users/dave/addresses/1) should map
- resources_path to /users/dave/addresses
- resource_path to /users/dave/addresses/1
- resource_path(9) to /users/dave/addresses/9
- edit_resource_path to /users/dave/addresses/1/edit
- edit_resource_path(9) to /users/dave/addresses/9/edit
- new_resource_path to /users/dave/addresses/new
 
resource_service in AddressesController
- should build new address with @user foreign key with new
- should find @address with find(@address.id)
- should raise RecordNotFound with find(@other_address.id)
- should find only addresses belonging to @user with find(:all)
 
Requesting /users/dave/addresses
- should find the user
- should assign the found user for the view
- should assign the user_addresses association as the addresses resource_service
 
Requesting /users/dave/addresses using GET
- should be successful
- should render index.rhtml
- should find all addresses
- should assign the found addresses for the view
 
Requesting /users/dave/addresses/1 using GET
- should be successful
- should render show.rhtml
- should find the thing requested
- should assign the found thing for the view
 
Requesting /users/dave/addresses/new using GET
- should be successful
- should render new.rhtml
- should create an new thing
- should not save the new thing
- should assign the new thing for the view
 
Requesting /users/dave/addresses/1/edit using GET
- should be successful
- should render edit.rhtml
- should find the thing requested
- should assign the found Thing for the view
 
Requesting /users/dave/addresses using POST
- should create a new address
- should redirect to the new address
 
Requesting /users/dave/addresses/1 using PUT
- should find the address requested
- should update the found address
- should assign the found address for the view
- should redirect to the address
 
Requesting /users/dave/addresses/1 using DELETE
- should find the address requested
- should call destroy on the found thing
- should redirect to the things list
 
Routing shortcuts for Admin::Forums should map
- resources_path to /admin/forums
- resources_path(:foo => 'bar') to /admin/forums?foo=bar
- resource_path to /admin/forums/2
- resource_path(:foo => 'bar') to /admin/forums/2?foo=bar
- resource_path(9) to /admin/forums/9
- resource_path(9, :foo => 'bar') to /admin/forums/2?foo=bar
- edit_resource_path to /admin/forums/2/edit
- edit_resource_path(9) to /admin/forums/9/edit
- new_resource_path to /admin/forums/new
- resources_url to http://test.host/admin/forums
- resource_url to http://test.host/admin/forums/2
- resource_url(9) to http://test.host/admin/forums/9
- edit_resource_url to http://test.host/admin/forums/2/edit
- edit_resource_url(9) to http://test.host/admin/forums/9/edit
- new_resource_url to http://test.host/admin/forums/new
- resource_interests_path to /admin/forums/2/interests
- resource_interests_path(:foo => 'bar') to /admin/forums/2/interests?foo=bar
- resource_interests_path(9) to /admin/forums/9/interests
- resource_interests_path(9, :foo => 'bar') to /admin/forums/9/interests?foo=bar
- resource_interest_path(5) to /admin/forums/2/interests/5
- resource_interest_path(9,5) to /admin/forums/9/interests/5
- resource_interest_path(9,5, :foo => 'bar') to /admin/forums/9/interests/5?foo=bar
- new_resource_interest_path(9) to /admin/forums/9/interests/new
- edit_resource_interest_path(5) to /admin/forums/2/interests/5/edit
- edit_resource_interest_path(9,5) to /admin/forums/9/interests/5/edit
- respond_to?(:edit_resource_interest_path) should == true
- resource_users_path should raise informative CantMapRoute
- enclosing_resource_path should raise informative NoMethodError
- any_old_missing_method should raise NoMethodError
- respond_to?(:resource_users_path) should == false
 
resource_service in Admin::ForumsController
- should build new forum with new
- should find @forum with find(@forum.id)
- should find all forums with find(:all)
 
Requesting /admin/forums using GET
- should be successful
- should render index.rhtml
- should find all forums
- should assign the found forums for the view
 
Requesting /admin/forums.xml using GET
- should be successful
- should find all forums
- should render the found forums as xml
 
Requesting /admin/forums using XHR GET
- should be successful
- should find all forums
- should render index.rjs
 
Requesting /admin/forums/1 using GET
- should be successful
- should render show.rhtml
- should find the forum requested
- should assign the found forum for the view
 
Requesting /admin/forums/1.xml using GET
- should be successful
- should find the forum requested
- should render the found forum as xml
 
Requesting /admin/forums/1 using XHR GET
- should be successful
- should render show.rjs
- should find the forum requested
- should assign the found forum for the view
 
Requesting /admin/forums/new using GET
- should be successful
- should render new.rhtml
- should create an new forum
- should not save the new forum
- should assign the new forum for the view
 
Requesting /admin/forums/1/edit using GET
- should be successful
- should render edit.rhtml
- should find the forum requested
- should assign the found Forum for the view
 
Requesting /admin/forums using POST
- should create a new forum
- should set the flash notice
- should redirect to the new forum
 
Requesting /admin/forums using XHR POST
- should create a new forum
- should not set the flash notice
- should render create.rjs
- should render new.rjs if unsuccesful
 
Requesting /admin/forums/1 using PUT
- should find the forum requested
- should set the flash notice
- should update the found forum
- should assign the found forum for the view
- should redirect to the forum
 
Requesting /admin/forums/1 using XHR PUT
- should find the forum requested
- should update the found forum
- should not set the flash notice
- should assign the found forum for the view
- should render update.rjs
- should render edit.rjs, on unsuccessful save
 
Requesting /admin/forums/1 using DELETE
- should find the forum requested
- should call destroy on the found forum
- should set the flash notice
- should redirect to the forums list
 
Requesting /admin/forums/1 using XHR DELETE
- should find the forum requested
- should not set the flash notice
- should call destroy on the found forum
- should render destroy.rjs
 
Routing shortcuts for Comments (forums/3/posts/2/comments/1) should map
- resources_path to /forums/3/posts/2/comments
- resource_path to /forums/3/posts/2/comments/1
- resource_path(9) to /forums/3/posts/2/comments/9
- edit_resource_path to /forums/3/posts/2/comments/1/edit
- edit_resource_path(9) to /forums/3/posts/2/comments/9/edit
- new_resource_path to /forums/3/posts/2/comments/new
- resource_tags_path to /forums/3/posts/2/comments/1/tags
- resource_tags_path(9) to /forums/3/posts/2/comments/9/tags
- resource_tag_path(5) to /forums/3/posts/2/comments/1/tags/5
- resource_tag_path(9,5) to /forums/3/posts/2/comments/9/tags/5
 
resource_service in CommentsController
- should build new comment with @post foreign key with new
- should find @comment with find(@comment.id)
- should raise RecordNotFound with find(@other_post.id)
- should find only comments belonging to @post with find(:all)
 
Requesting /forums/3/posts/2/comments (testing the before filters)
- should find the forum
- should assign the found forum for the view
- should find the post
- should assign the found post for the view
- should assign the post_comments association as the comments resource_service
 
Requesting /forums/3/posts/2/comments using GET
- should be successful
- should render index.rhtml
- should find comments in post
- should assign the found comments for the view
 
Requesting /forums/3/posts/3/comments/1 using GET
- should be successful
- should render show.rhtml
- should find the comment requested
- should assign the found comment for the view
 
Requesting /forums/3/posts/3/comments/new using GET
- should be successful
- should render new.rhtml
- should create a new comment
- should not save the new comment
- should assign the new comment for the view
 
Requesting /forums/3/posts/3/comments/1/edit using GET
- should be successful
- should render edit.rhtml
- should find the comment requested
- should assign the found comment for the view
 
Requesting /forums/3/posts/3/comments using POST
- should create a new comment
- should redirect to the new comment
 
Requesting /forums/3/posts/3/comments/1 using PUT
- should find the comment requested
- should update the found comment
- should assign the found comment for the view
- should redirect to the comment
 
Requesting /forums/3/posts/3/comments/1 using DELETE
- should find the comment requested
- should call destroy on the found comment
- should redirect to the comments list
 
CommentsController without stubs responding to GET index
- should expose all comments as @comments
 
CommentsController without stubs responding to GET index with mime type of xml
- should render all comments as xml
 
CommentsController without stubs responding to GET show
- should expose the requested comment as @comment
 
CommentsController without stubs responding to GET show with mime type of xml
- should render the requested comment as xml
 
CommentsController without stubs responding to GET new
- should expose a new comment as @comment
 
CommentsController without stubs responding to GET edit
- should expose the requested comment as @comment
 
CommentsController without stubs responding to POST create with valid params
- should create a comment
- should expose the newly created comment as @comment
- should be resource_saved?
- should redirect to the created comment
 
CommentsController without stubs responding to POST create with invalid params
- should not create a comment
- should expose a newly created but unsaved comment as @comment
- should not be resource_saved?
- should re-render the 'new' template
 
CommentsController without stubs responding to PUT udpate with valid params
- should update the requested comment
- should not contain errors on comment
- should be resource_saved?
- should expose the requested comment as @comment
- should redirect to the comment
 
CommentsController without stubs responding to PUT udpate with invalid params
- should fail to update the requested comment
- should not be resource_saved?
- should expose the requested comment as @comment
- should re-render the 'edit' template
 
CommentsController without stubs responding to DELETE destroy
- should delete the requested comment
- should redirect to the comments list
 
Routing shortcuts for ForumPosts (forums/2/posts/1) should map
- resources_path to /forums/2/posts
- resource_path to /forums/2/posts/1
- resource_path(9) to /forums/2/posts/9
- edit_resource_path to /forums/2/posts/1/edit
- edit_resource_path(9) to /forums/2/posts/9/edit
- new_resource_path to /forums/2/posts/new
- resource_tags_path to /forums/2/posts/1/tags
- resource_tags_path(9) to /forums/2/posts/9/tags
- resource_tag_path(5) to /forums/2/posts/1/tags/5
- resource_tag_path(9,5) to /forums/2/posts/9/tags/5
- enclosing_resource_path to /forums/2
- enclosing_resource_path(9) to /forums/9
- enclosing_resources_path to /forums
- new_enclosing_resource_path to /forums/new
- enclosing_resource_tags_path to /forums/2/tags
- enclosing_resource_tag_path(9) to /forums/2/tags/9
- enclosing_resource_tag_path(8,9) to /forums/8/tags/9
 
ForumPostsController errors
- should raise ResourceMismatch for /posts
- should raise MissingSegment, when route does not contain the resource segment
- should raise NoRecognizedRoute when no route is recognized
 
resource_service in ForumPostsController
- should build new post with @forum foreign key with new
- should find @post with find(@post.id)
- should raise RecordNotFound with find(@other_post.id)
- should find only posts belonging to @forum with find(:all)
 
ForumPostsController order of before_filters
- should == [:abstract, :posts, :load_enclosing, :forum_posts]
 
Requesting /forums/2/posts (testing the before filters)
- should find the forum
- should assign the form as other_name_for_forum
- should assign the found forum for the view
- should assign the forum_posts association as the posts resource_service
 
Requesting /forums/2/posts using GET
- should be successful
- should render index.rhtml
- should find all posts, in reverse order (because of AbstractPostsController)
- should assign the found posts for the view
 
Requesting /forums/2/posts/1 using GET
- should be successful
- should render show.rhtml
- should find the thing requested
- should assign the found thing for the view
 
Requesting /forums/2/posts/new using GET
- should be successful
- should render new.rhtml
- should create an new thing
- should not save the new thing
- should assign the new thing for the view
 
Requesting /forums/2/posts/1/edit using GET
- should be successful
- should render edit.rhtml
- should find the thing requested
- should assign the found Thing for the view
 
Requesting /forums/2/posts using POST
- should make a new post
- should attempt to save the new post
- should redirect to the new post.save == true
- should render new when post.save == false
 
Requesting /forums/2/posts/1 using PUT
- should find the post requested
- should update the found post
- should assign the found post for the view
- should redirect to the post
 
Requesting /forums/2/posts/1 using DELETE
- should find the post requested
- should call destroy on the found thing
- should redirect to the things list
 
Routing shortcuts for Forums should map
- resources_path to /forums
- resources_path(:foo => 'bar') to /forums?foo=bar
- resource_path to /forums/2
- resource_path(:foo => 'bar') to /forums/2?foo=bar
- resource_path(9) to /forums/9
- resource_path(9, :foo => 'bar') to /forums/2?foo=bar
- edit_resource_path to /forums/2/edit
- edit_resource_path(9) to /forums/9/edit
- new_resource_path to /forums/new
- resources_url to http://test.host/forums
- resource_url to http://test.host/forums/2
- resource_url(9) to http://test.host/forums/9
- edit_resource_url to http://test.host/forums/2/edit
- edit_resource_url(9) to http://test.host/forums/9/edit
- new_resource_url to http://test.host/forums/new
- resource_interests_path to /forums/2/interests
- resource_interests_path(:foo => 'bar') to /forums/2/interests?foo=bar
- resource_interests_path(9) to /forums/9/interests
- resource_interests_path(9, :foo => 'bar') to /forums/9/interests?foo=bar
- resource_interest_path(5) to /forums/2/interests/5
- resource_interest_path(9,5) to /forums/9/interests/5
- resource_interest_path(9,5, :foo => 'bar') to /forums/9/interests/5?foo=bar
- new_resource_interest_path(9) to /forums/9/interests/new
- edit_resource_interest_path(5) to /forums/2/interests/5/edit
- edit_resource_interest_path(9,5) to /forums/9/interests/5/edit
- respond_to?(:edit_resource_interest_path) should == true
- resource_users_path should raise informative NoMethodError
- enclosing_resource_path should raise informative NoMethodError
- any_old_missing_method should raise NoMethodError
- respond_to?(:resource_users_path) should == false
 
ForumsController (checking that non actions are hidden)
- should only have CRUD actions as action_methods
 
resource_service in ForumsController
- should build new forum with new
- should find @forum with find(@forum.id)
- should find all forums with find(:all)
 
ForumsController requesting / (testing resource_path)
- should generate params { :controller => 'forums', :action => 'index', :resource_path => '/forums' } from GET /
- should be successful
- should render index.rhtml
- should find all forums
- should assign the found forums for the view
 
ForumsController requesting /create_forum (testing resource_method)
- should generate params { :controller => 'forums', :action => 'create', :resource_path => '/forums', :resource_method => :post } from GET /create_forum
- should create a new forum
- should set the flash notice
- should redirect to the new forum
 
Requesting /forums using GET
- should be successful
- should render index.rhtml
- should find all forums
- should assign the found forums for the view
 
Requesting /forums.xml using GET
- should be successful
- should find all forums
- should render the found forums as xml
 
Requesting /forums using XHR GET
- should be successful
- should find all forums
- should render index.rjs
 
Requesting /forums/1 using GET
- should be successful
- should render show.rhtml
- should find the forum requested
- should assign the found forum for the view
 
Requesting /forums/1.xml using GET
- should be successful
- should find the forum requested
- should render the found forum as xml
 
Requesting /forums/1 using XHR GET
- should be successful
- should render show.rjs
- should find the forum requested
- should assign the found forum for the view
 
Requesting /forums/new using GET
- should be successful
- should render new.rhtml
- should create an new forum
- should not save the new forum
- should assign the new forum for the view
 
Requesting /forums/1/edit using GET
- should be successful
- should render edit.rhtml
- should find the forum requested
- should assign the found Forum for the view
 
Requesting /forums using POST
- should create a new forum
- should set the flash notice
- should redirect to the new forum
 
Requesting /forums using XHR POST
- should create a new forum
- should not set the flash notice
- should render create.rjs
- should render new.rjs if unsuccesful
 
Requesting /forums/1 using PUT
- should find the forum requested
- should set the flash notice
- should update the found forum
- should assign the found forum for the view
- should redirect to the forum
 
Requesting /forums/1 using XHR PUT
- should find the forum requested
- should update the found forum
- should not set the flash notice
- should assign the found forum for the view
- should render update.rjs
- should render edit.rjs, on unsuccessful save
 
Requesting /forums/1 using DELETE
- should find the forum requested
- should call destroy on the found forum
- should set the flash notice
- should redirect to the forums list
 
Requesting /forums/1 using XHR DELETE
- should find the forum requested
- should not set the flash notice
- should call destroy on the found forum
- should render destroy.rjs
 
Routing shortcuts for Infos should map
- resource_path to /account/info
- resource_tags_path to /account/info/tags
 
InfosController (its actions)
- should have only ['show', 'edit', 'update'] in action_methods
- GET /account/info should be successful
- GET /account/info/edit should be successful
- PUT /account/info should be successful
- GET /account/info/new should raise UnknownAction
- POST /account/info should raise UnknownAction
- DELETE /account/info/new should raise UnknownAction
 
Routing shortcuts for Interests via Forum (forums/1/interests/2) should map
- resources_path to /forums/1/interests
- resource_path to /forums/1/interests/2
- resource_path(9) to /forums/1/interests/9
- edit_resource_path to /forums/1/interests/2/edit
- edit_resource_path(9) to /forums/1/interests/9/edit
- new_resource_path to /forums/1/interests/new
 
resource_service in InterestsController via Forum
- should build new interest with @forum fk and type with new
- should find @interest with find(@interest.id)
- should raise RecordNotFound with find(@other_interest.id)
- should find only interests belonging to @forum with find(:all)
 
Requesting /forums/1/interests using GET
- should find the forum
- should assign the found forum as :interested_in for the view
- should assign the forum_interests association as the interests resource_service
 
Routing shortcuts for Interests via User (users/dave/interests/2) should map
- resources_path to /users/dave/interests
- resource_path to /users/dave/interests/2
- resource_path(9) to /users/dave/interests/9
- edit_resource_path to /users/dave/interests/2/edit
- edit_resource_path(9) to /users/dave/interests/9/edit
- new_resource_path to /users/dave/interests/new
 
resource_service in InterestsController via Forum
- should build new interest with @user fk and type with new
- should find @interest with find(@interest.id)
- should raise RecordNotFound with find(@other_interest.id)
- should find only interests belonging to @user with find(:all)
 
Requesting /users/dave/interests using GET
- should find the user
- should assign the found user as :interested_in for the view
- should assign the user_interests association as the interests resource_service
 
Routing shortcuts for ForumOwner should map
- resource_path to /forums/2/owner
- resource_path(:foo => 'bar') to /forums/2/owner?foo=bar
- edit_resource_path to /forums/2/owner/edit
- new_resource_path to /forums/2/owner/new
- resource_posts_path to /forums/2/owner/posts
- resource_posts_path(:foo => 'bar') to /forums/2/owner/posts?foo=bar
- resource_post_path(5) to /forums/2/owner/posts/5
- enclosing_resource_path to /forums/2
 
OwnersController#resource_service
- .new should call :build_owner on @forum
- .find should call :owner on @forum
 
Requesting /forums/2/owner using GET
- should be successful
- should render show.rhtml
- should find the forum requested
- should assign the found forum for the view
- should find the owner from forum.owner
- should assign the found owner for the view
 
Requesting /forums/2/owner/new using GET
- should be successful
- should render new.rhtml
- should build a new owner
 
Requesting /forums/2/owner/edit using GET
- should be successful
- should render edit.rhtml
- should find the owner from forum.owner
 
Requesting /forums/2/owner using POST
- should build a new owner
- should set the flash notice
- should redirect to the new owner
- should render new when post unsuccesful
 
Requesting /forums/2/owner using PUT
- should find the owner from forum.owner
- should set the flash notice
- should update the owner
- should redirect to the owner
 
Requesting /forums/2/owner using DELETE
- should find the owner from forum.owner
- should call destroy on the owner
- should set the flash notice
- should redirect to forums/2
 
CommentsController#resource_saved Comment.new(<invalid attrs>)
- should not be resource saved
 
CommentsController#resource_saved Comment.new(<invalid attrs>).save
- should not be resource saved
 
CommentsController#resource_saved Comment.new(<invalid attrs>).save then update_attributes(<valid attrs>)
- should be resource saved
 
CommentsController#resource_saved Comment.find(<id>)
- should be resource saved
- .save should be saved
 
CommentsController#resource_saved Comment.find(<id>) then update_attributes(<invalid attrs>)
- should not be resource saved
 
CommentsController#resource_saved Comment.find(<id>) then update_attributes(<new valid attrs>)
- should be resource saved
 
Routing shortcuts for Tags should map
- resources_path to /tags
- resource_path to /tags/2
- resource_path(9) to /tags/9
- edit_resource_path to /tags/2/edit
- edit_resource_path(9) to /tags/9/edit
- new_resource_path to /forums/1/tags/new
- enclosing_resource_path should raise error
 
resource_service in TagsController
- .new should call new on Tag
- .find should call find on Tag
 
Requesting /tags using GET
- should find the tags
- should assign the tags for the view
 
Routing shortcuts for Tags via account info (/account/info/) should map
- resources_path to /account/info/tags
- resource_path to /account/info/tags/2
- resource_path(9) to /account/info/tags/9
- edit_resource_path to /account/info/tags/2/edit
- edit_resource_path(9) to /account/info/tags/9/edit
- new_resource_path to /account/info/tags/new
- enclosing_resource_path to /account/info
 
resource_service in TagsController via Account Info
- should build new tag with @info fk and type with new
- should find @tag with find(@tag.id)
- should raise RecordNotFound with find(@other_tag.id)
- should find only tags belonging to @info with find(:all)
 
Requesting /forums/1/tags using GET
- should find the account as current_user
- should get info from current_user
- should get tags assoc from info
- should get tags from tags assoc
 
Routing shortcuts for Tags via Forum, Post and Comment (forums/1/posts/2/comments/3tags/4) should map
- resources_path to /forums/1/posts/2/comments/3/tags
- resource_path to /forums/1/posts/2/comments/3/tags/4
- resource_path(9) to /forums/1/posts/2/comments/3/tags/9
- edit_resource_path to /forums/1/posts/2/comments/3/tags/4/edit
- edit_resource_path(9) to /forums/1/posts/2/comments/3/tags/9/edit
- new_resource_path to /forums/1/posts/2/comments/3/tags/new
- enclosing_resource_path to /forums/1/posts/2/comments/3
 
resource_service in TagsController via Forum, Post and Comment
- should build new tag with @comment fk and type with new
- should find @tag with find(@tag.id)
- should raise RecordNotFound with find(@other_tag.id)
- should find only tags belonging to @post with find(:all)
 
Requesting /forums/1/posts/2/comment/3/tags using GET
- should find the forum
- should find the post
- should find the comment
- should assign the found forum, post, and comment for the view
- should assign the comment_tags association as the tags resource_service
 
Routing shortcuts for Tags via Forum and Post (forums/1/posts/2/tags/3) should map
- resources_path to /forums/1/posts/2/tags
- resource_path to /forums/1/posts/2/tags/3
- resource_path(9) to /forums/1/posts/2/tags/9
- edit_resource_path to /forums/1/posts/2/tags/3/edit
- edit_resource_path(9) to /forums/1/posts/2/tags/9/edit
- new_resource_path to /forums/1/posts/2/tags/new
- enclosing_resource_path to /forums/1/posts/2
 
resource_service in TagsController via Forum and Post
- should build new tag with @post fk and type with new
- should find @tag with find(@tag.id)
- should raise RecordNotFound with find(@other_tag.id)
- should find only tags belonging to @post with find(:all)
 
Requesting /forums/1/posts/2/tags using GET
- should find the forum
- should find the post
- should assign the found post for the view
- should assign the post_tags association as the tags resource_service
 
Routing shortcuts for Tags via Forum (forums/1/tags/2) should map
- resources_path to /forums/1/tags
- resource_path to /forums/1/tags/2
- resource_path(9) to /forums/1/tags/9
- edit_resource_path to /forums/1/tags/2/edit
- edit_resource_path(9) to /forums/1/tags/9/edit
- new_resource_path to /forums/1/tags/new
- enclosing_resource_path to /forums/1
 
resource_service in TagsController via Forum
- should build new tag with @forum fk and type with new
- should find @tag with find(@tag.id)
- should raise RecordNotFound with find(@other_tag.id)
- should find only tags belonging to @forum with find(:all)
 
Requesting /forums/1/tags using GET
- should find the forum
- should assign the found forum for the view
- should assign the forum_tags association as the tags resource_service
 
Requesting /forums/1/tags/new using GET
- should find the forum
- should assign the found forum for the view
- should assign the forum_tags association as the tags resource_service
- should render new template
- should create a new tag with params
- should not save the new category
- should assign the new tag for the view
- should send :resource= to controller with @tag
 
Routing shortcuts for Tags via User and Address (users/dave/addresses/2/tags/3) should map
- resources_path to /users/dave/addresses/2/tags
- resource_path to /users/dave/addresses/2/tags/3
- resource_path(9) to /users/dave/addresses/2/tags/9
- edit_resource_path to /users/dave/addresses/2/tags/3/edit
- edit_resource_path(9) to /users/dave/addresses/2/tags/9/edit
- new_resource_path to /users/dave/addresses/2/tags/new
- enclosing_resource_path to /users/dave/addresses/2
 
resource_service in TagsController via User and Address
- should build new tag with @address fk and type with new
- should find @tag with find(@tag.id)
- should raise RecordNotFound with find(@other_tag.id)
- should find only tags belonging to @address with find(:all)
 
Requesting /users/dave/addresses/2/tags using GET
- should find the user
- should find the address
- should assign the found address for the view
- should assign the address_tags association as the tags resource_service
 
UsersController#route_for
- should map { :controller => 'users', :action => 'index' } to /users
- should map { :controller => 'users', :action => 'new' } to /users/new
- should map { :controller => 'users', :action => 'show', :id => 'dave' } to /users/dave
- should map { :controller => 'users', :action => 'edit', :id => 'dave' } to /users/dave/edit
- should map { :controller => 'users', :action => 'update', :id => 'dave'} to /users/dave
- should map { :controller => 'users', :action => 'destroy', :id => 'dave'} to /users/dave
 
UsersController#params_from
- should generate params { :controller => 'users', action => 'index' } from GET /users
- should generate params { :controller => 'users', action => 'new' } from GET /users/new
- should generate params { :controller => 'users', action => 'create' } from POST /users
- should generate params { :controller => 'users', action => 'show', id => '1' } from GET /users/dave
- should generate params { :controller => 'users', action => 'edit', id => '1' } from GET /users/dave;edit
- should generate params { :controller => 'users', action => 'update', id => '1' } from PUT /users/dave
- should generate params { :controller => 'users', action => 'destroy', id => '1' } from DELETE /users/dave
 
UsersController handling GET /users
- should be successful
- should render index template
- should find all users
- should assign the found users for the view
 
UsersController handling GET /users.xml
- should be successful
- should find all users
- should render the found users as xml
 
UsersController handling GET /users/dave
- should be successful
- should render show template
- should find the user requested
- should assign the found user for the view
 
UsersController handling GET /users/dave.xml
- should be successful
- should find the user requested
- should render the found user as xml
 
UsersController handling GET /users/new
- should be unknown action
 
UsersController handling GET /users/dave/edit
- should be successful
- should render edit template
- should find the user requested
- should assign the found User for the view
 
UsersController handling POST /users
- should be unknown action
 
UsersController handling PUT /users/dave
- should find the user requested
- should update the found user
- should assign the found user for the view
- should redirect to the user on successful update
- should re-render 'edit' on failed update
 
UsersController handling DELETE /users/dave
- should be unknown action
 
(re: saved?) Comment.new(<invalid attrs>)
- should not be validation attempted
- should not be saved
 
(re: saved?) Comment.new(<invalid attrs>).save
- should be validation attempted
- should not be saved
 
(re: saved?) Comment.new(<invalid attrs>).save then update_attributes(<valid attrs>)
- should be validation attempted
- should be saved
 
ActionView with resources_controller Helper
- should forward #resource_name to controller
- should forward #resources_name to controller
- should forward #resource to controller
- should forward #resources to controller
- should forward #enclosing_resource to controller
- should forward #enclosing_resource_name to controller
- should not forward unknown url helper to controller
- #error_messages_for_resource should call error_messages_for with resource_name
 
Helper#form_for_resource (when resource is new record)
- should call form_for with create form options
- when passed :url_options, they should be passed to the path generation
- when not passed :url_options, they should not be passed to the path generation
 
Helper#form_for_resource (when resource is new record) and resource is singleton
- should call form_for with create form options
 
Helper#form_for_resource (when resource is existing record)
- should call form_for with update form options
 
Helper#remote_form_for_resource (when resource is existing record)
- should call remote_form_for with update form options
 
#load_enclosing_resources for resources_controller_for :tags (when route_enclosing_names is [['users', false]])
- should call load_wildcard once
- should call Specification.new('user', :singleton => false, :as => nil)
 
#load_enclosing_resources for resources_controller_for :tags, with :account mapping (when route_enclosing_names is [['account', true]])
- should call load_wildcard once
- should call load_enclosing_resource_from_specification with account specification
- should not call Specification.new
 
#load_enclosing_resources for resources_controller_for :tags (when route_enclosing_names is [['users', false], ['forums', false]])
- should call load_wildcard twice
- should call Specification.new with ('user', :singleton => false, :as => nil), then ('forum', :singleton => false, :as => nil)
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', :comment] (when route_enclosing_names is [['comments', false]])
- should not call load_wildcard
- should not call Specification.new
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', :comment] (when route_enclosing_names is [['users', false], ['forums', false], ['comments', false]])
- should call load_wildcard twice
- should call Specification.new with ('user', :singleton => false, :as => nil), then ('forum', :singleton => false, :as => nil)
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', :comment] (when route_enclosing_names is [['users', false], ['forums', false], ['special', true], ['comments', false]])
- should call load_wildcard three times
- should call Specification.new with ('user', :singleton => false, :as => nil), ('forum', :singleton => false, :as => nil), then ('special', :singleton => true, :as => nil)
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', '?commentable', :comment] (when route_enclosing_names is [['users', false], ['comments', false]])
- should call load_wildcard once with 'commentable'
- should call Specification.new with ('user', :singleton => false, :as => 'commentable')
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', '?commentable', :comment] (when route_enclosing_names is [['users', false], ['forums', false], ['comments', false]])
- should call load_wildcard twice
- should call Specification.new with ('user', :singleton => false, :as => nil), ('forum', :singleton => false, :as => 'commentable')
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['*', '?commentable', :comment] (when route_enclosing_names is [['users', false], ['forums', false], ['posts', false], ['comments', false]])
- should call load_wildcard twice, then once with 'commentable'
- should call Specification.new with ('user', :singleton => false, :as => nil), ('forum', :singleton => false, :as => nil), then ('post', :singleton => false, :as => 'commentable')
 
#load_enclosing_resources for resources_controller_for :tags, :in => ['user', '*', '?taggable'] (when route_enclosing_names is [['users', false], ['comments', false]])
- should call load_enclosing_resource_from_specification with user spec, then load_wildcard once with 'taggable'
- should call Specification.new with ('comment', :singleton => false, :as => 'taggable')
 
ResourcesController.load_enclosing_resources_filter_exists? when :find_filter defined
- should call :find_filter with :load_enclosing_resources
 
ResourcesController.load_enclosing_resources_filter_exists? when :find_filter not defined
- should call :filter_chain
 
ResourcesController (in general)
- nested_in :foo, :polymorphic => true, :class => User should raise argument error (no options or block with polymorphic)
- resources_controller_for :forums, :in => [:user, '*', '*', :comment] should raise argument error (no multiple wildcards in a row)
 
ResourcesController#enclosing_resource_name
- should be the class name underscored
 
A controller's resource_service
- may be explicitly set with #resource_service=
 
deprecated methods
- #save_resource should send resource.save
 
#route_enclosing_names TagsController for named_route:
- :tags should be []
- :new_tag should be []
- :edit_tag should be []
- :tag should be []
- :forum_tags should be [["forums", false]]
- :forum_tag should be [["forums", false]]
- :user_addresses_tags should be [["users", false], ["addresses", false]]
- :account_info_tags should be [["account", true], ["info", true]]
- :new_account_info_tag should be [["account", true], ["info", true]]
 
#route_enclosing_names Admin::ForumsController for named_route:
- :admin_forums should be [[]]
 
#route_enclosing_names Admin::InterestsController for named_route:
- :admin_forum_interests should be [["forums", false]]
- :forums_interests should be ["forums", false]]
 
#route_enclosing_names Admin::Superduper::ForumsController for named_route:
- :admin_superduper_forums should be []
 
Finished in 8.455269 seconds
 
632 examples, 0 failures