routespec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/README.txt +66 -0
  2. data/Rakefile +26 -0
  3. data/bin/routespec +29 -0
  4. data/lib/routespec.rb +22 -0
  5. data/lib/routespec/builder.rb +111 -0
  6. data/lib/routespec/dyr.rb +50 -0
  7. data/lib/routespec/fyle.rb +72 -0
  8. data/lib/routespec/parser.rb +143 -0
  9. data/lib/routespec/railtie.rb +7 -0
  10. data/lib/routespec/routespec/requests/.gitkeep +0 -0
  11. data/lib/routespec/routespec/support/.gitkeep +0 -0
  12. data/lib/routespec/routespec/templates/default_spec.erb +24 -0
  13. data/lib/routespec/tasks.rb +18 -0
  14. data/lib/routespec/tasks/routespec.rake +22 -0
  15. data/lib/routespec/template_vars.rb +7 -0
  16. data/lib/routespec/version.rb +3 -0
  17. data/test/files/awesome.yml +1 -0
  18. data/test/files/response_code_vcr_spec.erb +24 -0
  19. data/test/files/routes.txt +12 -0
  20. data/test/files/routes.yml +193 -0
  21. data/test/files/routes_hash.rb +159 -0
  22. data/test/files/routes_hash_2.rb +153 -0
  23. data/test/files/routes_hash_3.rb +1 -0
  24. data/test/files/tasks_routes.txt +21 -0
  25. data/test/files/template_spec.erb +13 -0
  26. data/test/files/unclean.txt +11 -0
  27. data/test/rails311/Gemfile +4 -0
  28. data/test/rails311/Gemfile.lock +90 -0
  29. data/test/rails311/README +261 -0
  30. data/test/rails311/Rakefile +7 -0
  31. data/test/rails311/app/assets/images/rails.png +0 -0
  32. data/test/rails311/app/assets/javascripts/application.js +9 -0
  33. data/test/rails311/app/assets/javascripts/beers.js +2 -0
  34. data/test/rails311/app/assets/javascripts/chips.js +2 -0
  35. data/test/rails311/app/assets/javascripts/sports.js +2 -0
  36. data/test/rails311/app/assets/stylesheets/application.css +7 -0
  37. data/test/rails311/app/assets/stylesheets/beers.css +4 -0
  38. data/test/rails311/app/assets/stylesheets/chips.css +4 -0
  39. data/test/rails311/app/assets/stylesheets/scaffold.css +56 -0
  40. data/test/rails311/app/assets/stylesheets/sports.css +4 -0
  41. data/test/rails311/app/controllers/application_controller.rb +3 -0
  42. data/test/rails311/app/controllers/beers_controller.rb +83 -0
  43. data/test/rails311/app/controllers/chips_controller.rb +83 -0
  44. data/test/rails311/app/controllers/sports_controller.rb +83 -0
  45. data/test/rails311/app/helpers/application_helper.rb +2 -0
  46. data/test/rails311/app/helpers/beers_helper.rb +2 -0
  47. data/test/rails311/app/helpers/chips_helper.rb +2 -0
  48. data/test/rails311/app/helpers/sports_helper.rb +2 -0
  49. data/test/rails311/app/models/beer.rb +2 -0
  50. data/test/rails311/app/models/chip.rb +2 -0
  51. data/test/rails311/app/models/sport.rb +2 -0
  52. data/test/rails311/app/views/beers/_form.html.erb +17 -0
  53. data/test/rails311/app/views/beers/edit.html.erb +6 -0
  54. data/test/rails311/app/views/beers/index.html.erb +21 -0
  55. data/test/rails311/app/views/beers/new.html.erb +5 -0
  56. data/test/rails311/app/views/beers/show.html.erb +5 -0
  57. data/test/rails311/app/views/chips/_form.html.erb +17 -0
  58. data/test/rails311/app/views/chips/edit.html.erb +6 -0
  59. data/test/rails311/app/views/chips/index.html.erb +21 -0
  60. data/test/rails311/app/views/chips/new.html.erb +5 -0
  61. data/test/rails311/app/views/chips/show.html.erb +5 -0
  62. data/test/rails311/app/views/layouts/application.html.erb +14 -0
  63. data/test/rails311/app/views/sports/_form.html.erb +17 -0
  64. data/test/rails311/app/views/sports/edit.html.erb +6 -0
  65. data/test/rails311/app/views/sports/index.html.erb +21 -0
  66. data/test/rails311/app/views/sports/new.html.erb +5 -0
  67. data/test/rails311/app/views/sports/show.html.erb +5 -0
  68. data/test/rails311/config.ru +4 -0
  69. data/test/rails311/config/application.rb +48 -0
  70. data/test/rails311/config/boot.rb +6 -0
  71. data/test/rails311/config/database.yml +25 -0
  72. data/test/rails311/config/environment.rb +5 -0
  73. data/test/rails311/config/environments/development.rb +30 -0
  74. data/test/rails311/config/environments/production.rb +60 -0
  75. data/test/rails311/config/environments/test.rb +39 -0
  76. data/test/rails311/config/initializers/backtrace_silencers.rb +7 -0
  77. data/test/rails311/config/initializers/inflections.rb +10 -0
  78. data/test/rails311/config/initializers/mime_types.rb +5 -0
  79. data/test/rails311/config/initializers/secret_token.rb +7 -0
  80. data/test/rails311/config/initializers/session_store.rb +8 -0
  81. data/test/rails311/config/initializers/wrap_parameters.rb +14 -0
  82. data/test/rails311/config/locales/en.yml +5 -0
  83. data/test/rails311/config/routes.rb +64 -0
  84. data/test/rails311/db/development.sqlite3 +0 -0
  85. data/test/rails311/db/migrate/20111227222038_create_beers.rb +8 -0
  86. data/test/rails311/db/migrate/20111227222056_create_chips.rb +8 -0
  87. data/test/rails311/db/migrate/20111227222113_create_sports.rb +8 -0
  88. data/test/rails311/db/schema.rb +31 -0
  89. data/test/rails311/db/seeds.rb +7 -0
  90. data/test/rails311/db/test.sqlite3 +0 -0
  91. data/test/rails311/doc/README_FOR_APP +2 -0
  92. data/test/rails311/log/development.log +28 -0
  93. data/test/rails311/log/test.log +0 -0
  94. data/test/rails311/public/404.html +26 -0
  95. data/test/rails311/public/422.html +26 -0
  96. data/test/rails311/public/500.html +26 -0
  97. data/test/rails311/public/favicon.ico +0 -0
  98. data/test/rails311/public/index.html +241 -0
  99. data/test/rails311/public/robots.txt +5 -0
  100. data/test/rails311/script/rails +6 -0
  101. data/test/rails311/spec/routespec/requests/beers/beers_spec.rb +74 -0
  102. data/test/rails311/spec/routespec/requests/chips/chips_spec.rb +74 -0
  103. data/test/rails311/spec/routespec/requests/sports/sports_spec.rb +74 -0
  104. data/test/rails311/spec/routespec/support/routes.txt +21 -0
  105. data/test/rails311/spec/routespec/support/routes.yml +322 -0
  106. data/test/rails311/spec/routespec/templates/default_spec.erb +24 -0
  107. data/test/rails311/test/fixtures/beers.yml +11 -0
  108. data/test/rails311/test/fixtures/chips.yml +11 -0
  109. data/test/rails311/test/fixtures/sports.yml +11 -0
  110. data/test/rails311/test/functional/beers_controller_test.rb +49 -0
  111. data/test/rails311/test/functional/chips_controller_test.rb +49 -0
  112. data/test/rails311/test/functional/sports_controller_test.rb +49 -0
  113. data/test/rails311/test/performance/browsing_test.rb +12 -0
  114. data/test/rails311/test/test_helper.rb +13 -0
  115. data/test/rails311/test/unit/beer_test.rb +7 -0
  116. data/test/rails311/test/unit/chip_test.rb +7 -0
  117. data/test/rails311/test/unit/helpers/beers_helper_test.rb +4 -0
  118. data/test/rails311/test/unit/helpers/chips_helper_test.rb +4 -0
  119. data/test/rails311/test/unit/helpers/sports_helper_test.rb +4 -0
  120. data/test/rails311/test/unit/sport_test.rb +7 -0
  121. data/test/rails311/vendor/cache/actionmailer-3.1.1.gem +0 -0
  122. data/test/rails311/vendor/cache/actionpack-3.1.1.gem +0 -0
  123. data/test/rails311/vendor/cache/activemodel-3.1.1.gem +0 -0
  124. data/test/rails311/vendor/cache/activerecord-3.1.1.gem +0 -0
  125. data/test/rails311/vendor/cache/activeresource-3.1.1.gem +0 -0
  126. data/test/rails311/vendor/cache/activesupport-3.1.1.gem +0 -0
  127. data/test/rails311/vendor/cache/arel-2.2.1.gem +0 -0
  128. data/test/rails311/vendor/cache/builder-3.0.0.gem +0 -0
  129. data/test/rails311/vendor/cache/erubis-2.7.0.gem +0 -0
  130. data/test/rails311/vendor/cache/hike-1.2.1.gem +0 -0
  131. data/test/rails311/vendor/cache/i18n-0.6.0.gem +0 -0
  132. data/test/rails311/vendor/cache/json-1.6.4.gem +0 -0
  133. data/test/rails311/vendor/cache/mail-2.3.0.gem +0 -0
  134. data/test/rails311/vendor/cache/mime-types-1.17.2.gem +0 -0
  135. data/test/rails311/vendor/cache/multi_json-1.0.4.gem +0 -0
  136. data/test/rails311/vendor/cache/polyglot-0.3.3.gem +0 -0
  137. data/test/rails311/vendor/cache/rack-1.3.5.gem +0 -0
  138. data/test/rails311/vendor/cache/rack-cache-1.1.gem +0 -0
  139. data/test/rails311/vendor/cache/rack-mount-0.8.3.gem +0 -0
  140. data/test/rails311/vendor/cache/rack-ssl-1.3.2.gem +0 -0
  141. data/test/rails311/vendor/cache/rack-test-0.6.1.gem +0 -0
  142. data/test/rails311/vendor/cache/rails-3.1.1.gem +0 -0
  143. data/test/rails311/vendor/cache/railties-3.1.1.gem +0 -0
  144. data/test/rails311/vendor/cache/rake-0.9.2.2.gem +0 -0
  145. data/test/rails311/vendor/cache/rdoc-3.12.gem +0 -0
  146. data/test/rails311/vendor/cache/sprockets-2.0.3.gem +0 -0
  147. data/test/rails311/vendor/cache/sqlite3-1.3.5.gem +0 -0
  148. data/test/rails311/vendor/cache/thor-0.14.6.gem +0 -0
  149. data/test/rails311/vendor/cache/tilt-1.3.3.gem +0 -0
  150. data/test/rails311/vendor/cache/treetop-1.4.10.gem +0 -0
  151. data/test/rails311/vendor/cache/tzinfo-0.3.31.gem +0 -0
  152. data/test/sandbox/awsome.txt +1 -0
  153. data/test/sandbox/cerveja/muito_legal/cool/cool_spec.rb +1 -0
  154. data/test/sandbox/cerveja/rad/rad_spec.rb +1 -0
  155. data/test/sandbox/cool.txt +4 -0
  156. data/test/sandbox/rails_root/routespec/templates/default_spec.erb +24 -0
  157. data/test/sandbox/requests/dynamic/dynamic_spec.rb +17 -0
  158. data/test/sandbox/requests/errors/errors_spec.rb +36 -0
  159. data/test/sandbox/requests/info_panel/info_panel_spec.rb +16 -0
  160. data/test/sandbox/requests/legacy/legacy_spec.rb +26 -0
  161. data/test/sandbox/requests2/dynamic/dynamic_spec.rb +17 -0
  162. data/test/sandbox/requests2/errors/errors_spec.rb +36 -0
  163. data/test/sandbox/requests2/info_panel/info_panel_spec.rb +16 -0
  164. data/test/sandbox/requests2/legacy/legacy_spec.rb +26 -0
  165. data/test/sandbox/routes.txt +21 -0
  166. data/test/sandbox/routes.yml +193 -0
  167. data/test/sandbox/seu_jorge.yml +3 -0
  168. data/test/test_builder.rb +118 -0
  169. data/test/test_config.rb +5 -0
  170. data/test/test_dyr.rb +56 -0
  171. data/test/test_fyle.rb +59 -0
  172. data/test/test_parser.rb +84 -0
  173. data/test/test_rails311.rb +15 -0
  174. data/test/test_routespec.rb +8 -0
  175. data/test/test_tasks.rb +26 -0
  176. data/test/test_template_vars.rb +18 -0
  177. metadata +382 -0
@@ -0,0 +1,153 @@
1
+ {:dynamic=>
2
+ [{:raw=>
3
+ "dynamic_controller /:controller/render_event_response(.:format) {:action=>\"render_event_response\"}",
4
+ :helper=>"dynamic_controller",
5
+ :http_verb=>"GET",
6
+ :path=>"/:controller/render_event_response(.:format)",
7
+ :action=>"render_event_response",
8
+ :controller=>nil,
9
+ :symbols=>["controller", "format"],
10
+ :address=>["dynamic"],
11
+ :status_code=>200,
12
+ :helper_path=>
13
+ "dynamic_controller_path(:controller => controller, :format => format)",
14
+ :vars=>["controller = \"REPLACE\"", "format = nil"]}],
15
+ :info_panel=>
16
+ [{:raw=>
17
+ "info_panel_edit GET /info_panel/edit(.:format) {:controller=>\"info_panel\", :action=>\"edit\"}",
18
+ :helper=>"info_panel_edit",
19
+ :http_verb=>"GET",
20
+ :path=>"/info_panel/edit(.:format)",
21
+ :action=>"edit",
22
+ :controller=>"info_panel",
23
+ :symbols=>["format"],
24
+ :address=>["info_panel"],
25
+ :status_code=>200,
26
+ :helper_path=>"info_panel_edit_path(:format => format)",
27
+ :vars=>["format = nil"]}],
28
+ :errors=>
29
+ [{:raw=>
30
+ "POST /errors(.:format) {:action=>\"create\", :controller=>\"errors\"}",
31
+ :helper=>nil,
32
+ :http_verb=>"POST",
33
+ :path=>"/errors(.:format)",
34
+ :action=>"create",
35
+ :controller=>"errors",
36
+ :symbols=>["format"],
37
+ :address=>["errors"],
38
+ :status_code=>201,
39
+ :helper_path=>"\"/errors\#{format ? \".\" : nil}\#{format}\"",
40
+ :vars=>["format = nil"]},
41
+ {:raw=>
42
+ "PUT /errors/:id(.:format) {:action=>\"update\", :controller=>\"errors\"}",
43
+ :helper=>nil,
44
+ :http_verb=>"PUT",
45
+ :path=>"/errors/:id(.:format)",
46
+ :action=>"update",
47
+ :controller=>"errors",
48
+ :symbols=>["id", "format"],
49
+ :address=>["errors"],
50
+ :status_code=>200,
51
+ :helper_path=>"\"/errors/\#{id}\#{format ? \".\" : nil}\#{format}\"",
52
+ :vars=>["id = \"REPLACE\"", "format = nil"]},
53
+ {:raw=>
54
+ "DELETE /errors/:id(.:format) {:action=>\"destroy\", :controller=>\"errors\"}",
55
+ :helper=>nil,
56
+ :http_verb=>"DELETE",
57
+ :path=>"/errors/:id(.:format)",
58
+ :action=>"destroy",
59
+ :controller=>"errors",
60
+ :symbols=>["id", "format"],
61
+ :address=>["errors"],
62
+ :status_code=>200,
63
+ :helper_path=>"\"/errors/\#{id}\#{format ? \".\" : nil}\#{format}\"",
64
+ :vars=>["id = \"REPLACE\"", "format = nil"]}],
65
+ :legacy=>
66
+ [{:raw=>"/index.cfm(.:format) {:controller=>\"legacy\", :action=>\"index\"}",
67
+ :helper=>nil,
68
+ :http_verb=>"GET",
69
+ :path=>"/index.cfm(.:format)",
70
+ :action=>"index",
71
+ :controller=>"legacy",
72
+ :symbols=>["format"],
73
+ :address=>["legacy"],
74
+ :status_code=>200,
75
+ :helper_path=>"\"/index\#{format ? \".\" : nil}cfm.\#{format}\"",
76
+ :vars=>["format = nil"]},
77
+ {:raw=>
78
+ "/listingid=:id(.:format) {:id=>/[0-9]+/, :controller=>\"legacy\", :action=>\"listingid\"}",
79
+ :helper=>nil,
80
+ :http_verb=>"GET",
81
+ :path=>"/listingid=:id(.:format)",
82
+ :action=>"listingid",
83
+ :controller=>"legacy",
84
+ :symbols=>["id", "format"],
85
+ :address=>["legacy"],
86
+ :status_code=>200,
87
+ :helper_path=>"\"/listingid=\#{id}\#{format ? \".\" : nil}\#{format}\"",
88
+ :vars=>["id = \"REPLACE\"", "format = nil"]}],
89
+ :agents_and_offices=>
90
+ {:listings=>
91
+ [{:raw=>
92
+ "/mls/:id(.:format) {:controller=>\"agents_and_offices/listings\", :action=>\"mls\"}",
93
+ :helper=>nil,
94
+ :http_verb=>"GET",
95
+ :path=>"/mls/:id(.:format)",
96
+ :action=>"mls",
97
+ :controller=>"agents_and_offices/listings",
98
+ :symbols=>["id", "format"],
99
+ :address=>["agents_and_offices", "listings"],
100
+ :status_code=>200,
101
+ :helper_path=>"\"/mls/\#{id}\#{format ? \".\" : nil}\#{format}\"",
102
+ :vars=>["id = \"REPLACE\"", "format = nil"]}],
103
+ :enquiries=>
104
+ [{:raw=>
105
+ "agent_listing_enquiries POST /agents/:agent_id/listings/:listing_id/enquiries(.:format) {:action=>\"create\", :controller=>\"agents_and_offices/enquiries\"}",
106
+ :helper=>"agent_listing_enquiries",
107
+ :http_verb=>"POST",
108
+ :path=>"/agents/:agent_id/listings/:listing_id/enquiries(.:format)",
109
+ :action=>"create",
110
+ :controller=>"agents_and_offices/enquiries",
111
+ :symbols=>["agent_id", "listing_id", "format"],
112
+ :address=>["agents_and_offices", "enquiries"],
113
+ :status_code=>201,
114
+ :helper_path=>
115
+ "agent_listing_enquiries_path(:agent_id => agent_id, :listing_id => listing_id, :format => format)",
116
+ :vars=>
117
+ ["agent_id = \"REPLACE\"", "listing_id = \"REPLACE\"", "format = nil"]},
118
+ {:raw=>
119
+ "new_agent_listing_enquiry GET /agents/:agent_id/listings/:listing_id/enquiries/new(.:format) {:action=>\"new\", :controller=>\"agents_and_offices/enquiries\"}",
120
+ :helper=>"new_agent_listing_enquiry",
121
+ :http_verb=>"GET",
122
+ :path=>"/agents/:agent_id/listings/:listing_id/enquiries/new(.:format)",
123
+ :action=>"new",
124
+ :controller=>"agents_and_offices/enquiries",
125
+ :symbols=>["agent_id", "listing_id", "format"],
126
+ :address=>["agents_and_offices", "enquiries"],
127
+ :status_code=>200,
128
+ :helper_path=>
129
+ "new_agent_listing_enquiry_path(:agent_id => agent_id, :listing_id => listing_id, :format => format)",
130
+ :vars=>
131
+ ["agent_id = \"REPLACE\"",
132
+ "listing_id = \"REPLACE\"",
133
+ "format = nil"]}],
134
+ :photos=>
135
+ [{:raw=>
136
+ "agent_listing_gallery_photo GET /agents/:agent_id/listings/:listing_id/galleries/:gallery_id/photos/:id(.:format) {:action=>\"show\", :controller=>\"agents_and_offices/photos\"}",
137
+ :helper=>"agent_listing_gallery_photo",
138
+ :http_verb=>"GET",
139
+ :path=>
140
+ "/agents/:agent_id/listings/:listing_id/galleries/:gallery_id/photos/:id(.:format)",
141
+ :action=>"show",
142
+ :controller=>"agents_and_offices/photos",
143
+ :symbols=>["agent_id", "listing_id", "gallery_id", "id", "format"],
144
+ :address=>["agents_and_offices", "photos"],
145
+ :status_code=>200,
146
+ :helper_path=>
147
+ "agent_listing_gallery_photo_path(:agent_id => agent_id, :listing_id => listing_id, :gallery_id => gallery_id, :id => id, :format => format)",
148
+ :vars=>
149
+ ["agent_id = \"REPLACE\"",
150
+ "listing_id = \"REPLACE\"",
151
+ "gallery_id = \"REPLACE\"",
152
+ "id = \"REPLACE\"",
153
+ "format = nil"]}]}}
@@ -0,0 +1 @@
1
+ {"/dynamic/dynamic_spec.rb"=>{:content=>"require \"spec_helper\"\n\n#\n# routes\n# dynamic_controller /:controller/render_event_response(.:format) {:action=>\"render_event_response\"}\n#\ndescribe \"dynamic response status codes\" do\n describe \"GET /:controller/render_event_response(.:format)\" do\n it \"should have a response\", :vcr do\n controller = \"REPLACE\"\n format = nil\n get dynamic_controller_path(:controller => controller, :format => format)\n response.status.should be(200)\n end\n end\n\nend", :address=>["dynamic"]}, "/info_panel/info_panel_spec.rb"=>{:content=>"require \"spec_helper\"\n\n#\n# routes\n# info_panel_edit GET /info_panel/edit(.:format) {:controller=>\"info_panel\", :action=>\"edit\"}\n#\ndescribe \"info_panel response status codes\" do\n describe \"GET /info_panel/edit(.:format)\" do\n it \"should have a response\", :vcr do\n format = nil\n get info_panel_edit_path(:format => format)\n response.status.should be(200)\n end\n end\n\nend", :address=>["info_panel"]}, "/errors/errors_spec.rb"=>{:content=>"require \"spec_helper\"\n\n#\n# routes\n# POST /errors(.:format) {:action=>\"create\", :controller=>\"errors\"}\n# PUT /errors/:id(.:format) {:action=>\"update\", :controller=>\"errors\"}\n# DELETE /errors/:id(.:format) {:action=>\"destroy\", :controller=>\"errors\"}\n#\ndescribe \"errors response status codes\" do\n describe \"POST /errors(.:format)\" do\n it \"should have a response\", :vcr do\n format = nil\n post \"/errors\#{format ? \".\" : nil}\#{format}\"\n response.status.should be(201)\n end\n end\n\n describe \"PUT /errors/:id(.:format)\" do\n it \"should have a response\", :vcr do\n id = \"REPLACE\"\n format = nil\n put \"/errors/\#{id}\#{format ? \".\" : nil}\#{format}\"\n response.status.should be(200)\n end\n end\n\n describe \"DELETE /errors/:id(.:format)\" do\n it \"should have a response\", :vcr do\n id = \"REPLACE\"\n format = nil\n delete \"/errors/\#{id}\#{format ? \".\" : nil}\#{format}\"\n response.status.should be(200)\n end\n end\n\nend", :address=>["errors"]}, "/legacy/legacy_spec.rb"=>{:content=>"require \"spec_helper\"\n\n#\n# routes\n# /index.cfm(.:format) {:controller=>\"legacy\", :action=>\"index\"}\n# /listingid=:id(.:format) {:id=>/[0-9]+/, :controller=>\"legacy\", :action=>\"listingid\"}\n#\ndescribe \"legacy response status codes\" do\n describe \"GET /index.cfm(.:format)\" do\n it \"should have a response\", :vcr do\n format = nil\n get \"/index\#{format ? \".\" : nil}cfm.\#{format}\"\n response.status.should be(200)\n end\n end\n\n describe \"GET /listingid=:id(.:format)\" do\n it \"should have a response\", :vcr do\n id = \"REPLACE\"\n format = nil\n get \"/listingid=\#{id}\#{format ? \".\" : nil}\#{format}\"\n response.status.should be(200)\n end\n end\n\nend", :address=>["legacy"]}}
@@ -0,0 +1,21 @@
1
+ sports GET /sports(.:format) {:action=>"index", :controller=>"sports"}
2
+ POST /sports(.:format) {:action=>"create", :controller=>"sports"}
3
+ new_sport GET /sports/new(.:format) {:action=>"new", :controller=>"sports"}
4
+ edit_sport GET /sports/:id/edit(.:format) {:action=>"edit", :controller=>"sports"}
5
+ sport GET /sports/:id(.:format) {:action=>"show", :controller=>"sports"}
6
+ PUT /sports/:id(.:format) {:action=>"update", :controller=>"sports"}
7
+ DELETE /sports/:id(.:format) {:action=>"destroy", :controller=>"sports"}
8
+ chips GET /chips(.:format) {:action=>"index", :controller=>"chips"}
9
+ POST /chips(.:format) {:action=>"create", :controller=>"chips"}
10
+ new_chip GET /chips/new(.:format) {:action=>"new", :controller=>"chips"}
11
+ edit_chip GET /chips/:id/edit(.:format) {:action=>"edit", :controller=>"chips"}
12
+ chip GET /chips/:id(.:format) {:action=>"show", :controller=>"chips"}
13
+ PUT /chips/:id(.:format) {:action=>"update", :controller=>"chips"}
14
+ DELETE /chips/:id(.:format) {:action=>"destroy", :controller=>"chips"}
15
+ beers GET /beers(.:format) {:action=>"index", :controller=>"beers"}
16
+ POST /beers(.:format) {:action=>"create", :controller=>"beers"}
17
+ new_beer GET /beers/new(.:format) {:action=>"new", :controller=>"beers"}
18
+ edit_beer GET /beers/:id/edit(.:format) {:action=>"edit", :controller=>"beers"}
19
+ beer GET /beers/:id(.:format) {:action=>"show", :controller=>"beers"}
20
+ PUT /beers/:id(.:format) {:action=>"update", :controller=>"beers"}
21
+ DELETE /beers/:id(.:format) {:action=>"destroy", :controller=>"beers"}
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ #
4
+ # some text
5
+ #
6
+ describe "<%= @name %>" do
7
+ describe "<%= @desc_1 %>" do
8
+ it "should have a <%= @desc_2 %>" do
9
+ response.status.should be(<%= @response %>)
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,11 @@
1
+ dirty
2
+
3
+ dirty
4
+ dirty
5
+
6
+ dirty
7
+
8
+
9
+ dirty
10
+
11
+ dirty
@@ -0,0 +1,4 @@
1
+ #source 'http://rubygems.org'
2
+ gem 'rails', '3.1.1'
3
+ gem 'sqlite3'
4
+ gem 'routespec'
@@ -0,0 +1,90 @@
1
+ GEM
2
+ specs:
3
+ actionmailer (3.1.1)
4
+ actionpack (= 3.1.1)
5
+ mail (~> 2.3.0)
6
+ actionpack (3.1.1)
7
+ activemodel (= 3.1.1)
8
+ activesupport (= 3.1.1)
9
+ builder (~> 3.0.0)
10
+ erubis (~> 2.7.0)
11
+ i18n (~> 0.6)
12
+ rack (~> 1.3.2)
13
+ rack-cache (~> 1.1)
14
+ rack-mount (~> 0.8.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.0.2)
17
+ activemodel (3.1.1)
18
+ activesupport (= 3.1.1)
19
+ builder (~> 3.0.0)
20
+ i18n (~> 0.6)
21
+ activerecord (3.1.1)
22
+ activemodel (= 3.1.1)
23
+ activesupport (= 3.1.1)
24
+ arel (~> 2.2.1)
25
+ tzinfo (~> 0.3.29)
26
+ activeresource (3.1.1)
27
+ activemodel (= 3.1.1)
28
+ activesupport (= 3.1.1)
29
+ activesupport (3.1.1)
30
+ multi_json (~> 1.0)
31
+ arel (2.2.1)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ hike (1.2.1)
35
+ i18n (0.6.0)
36
+ json (1.6.4)
37
+ mail (2.3.0)
38
+ i18n (>= 0.4.0)
39
+ mime-types (~> 1.16)
40
+ treetop (~> 1.4.8)
41
+ mime-types (1.17.2)
42
+ multi_json (1.0.4)
43
+ polyglot (0.3.3)
44
+ rack (1.3.5)
45
+ rack-cache (1.1)
46
+ rack (>= 0.4)
47
+ rack-mount (0.8.3)
48
+ rack (>= 1.0.0)
49
+ rack-ssl (1.3.2)
50
+ rack
51
+ rack-test (0.6.1)
52
+ rack (>= 1.0)
53
+ rails (3.1.1)
54
+ actionmailer (= 3.1.1)
55
+ actionpack (= 3.1.1)
56
+ activerecord (= 3.1.1)
57
+ activeresource (= 3.1.1)
58
+ activesupport (= 3.1.1)
59
+ bundler (~> 1.0)
60
+ railties (= 3.1.1)
61
+ railties (3.1.1)
62
+ actionpack (= 3.1.1)
63
+ activesupport (= 3.1.1)
64
+ rack-ssl (~> 1.3.2)
65
+ rake (>= 0.8.7)
66
+ rdoc (~> 3.4)
67
+ thor (~> 0.14.6)
68
+ rake (0.9.2.2)
69
+ rdoc (3.12)
70
+ json (~> 1.4)
71
+ routespec (0.0.1)
72
+ sprockets (2.0.3)
73
+ hike (~> 1.2)
74
+ rack (~> 1.0)
75
+ tilt (~> 1.1, != 1.3.0)
76
+ sqlite3 (1.3.5)
77
+ thor (0.14.6)
78
+ tilt (1.3.3)
79
+ treetop (1.4.10)
80
+ polyglot
81
+ polyglot (>= 0.3.1)
82
+ tzinfo (0.3.31)
83
+
84
+ PLATFORMS
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ rails (= 3.1.1)
89
+ routespec
90
+ sqlite3
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.