Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Backoo/rails
...
head fork: Backoo/rails
Checking mergeability… Don't worry, you can still create the pull request.
  • 18 commits
  • 325 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 09, 2012
@drogus drogus Add bare actionview gem to the root directory
This commit creates structure for Action View gem and is first of a
series of commits extracting Action View from Action Pack. I don't want
to do it in one large commit to allow easier track of changes later on.
d629332
@drogus drogus Move actionpack/lib/action_view* into actionview/lib cefbe8b
@drogus drogus Moved template tests from actionpack to actionview
I ensured that all the tests in actionpack still pass, but tests in
actionview fail. The reason for leaving them that way is that I don't
want to move files *and* change them at the same time as it will be
much harder to track changes that way using git log.
e5fc72e
@drogus drogus Remove unneeded files 07d2268
@drogus drogus Remove dependency on actionpack in ActionView::AssetPaths
Since Action View should not depend on actionpack, it's best to delegate
invalid_asset_host! to controller and just rely on such simple contract
instead of raising this exception directly.
ca6f5aa
@drogus drogus Move ActionController::RecordIdentifier to ActionView
Since it's more about DOM classes and ids it belongs to Action View
better. What's more, it's more convenient to make it part of Action View
to follow the rule that Action Pack can depend on Action View, but not
the other way round.
4667879
@drogus drogus Move action_controller/vendor/html-scanner to action_view
This is another step in moving Action View's dependencies in Action Pack
to Action View itself. Also, HtmlScanner seems to be better suited for
views rather than controllers.
39a9a2b
@drogus drogus Add actionpack as actionview's development dependency 380a1f9
@drogus drogus Add missing include in actionview/test/abstract_unit.rb
This needs to be insterted here to make code added in 60b4290 work. It's
not added here due to extraction of actionview into separate gem.
d28bb13
@drogus drogus Remove action_pack require from action_view.rb 0e24811
@drogus drogus Move ActionView::TestCase to Action Pack
Although it's a file in ActionView namespace, it's valid only for
testing views with ActionController involved. That's why it can't be
used in Action View alone and needs to be moved to Action Pack.
d924c2f
Commits on Jun 10, 2012
@drogus drogus Fix railties tests
Action View was moved out of Action Pack, so locales are now located
inside actionview gem.
8775842
Commits on Jun 14, 2012
@drogus drogus Remove stubs from LogSubscriber tests
We can use another way to instantiate ActionView::Base, by passing
renderer as a first option. Thanks to that we can just pass prefixes to
LookupContext instead stubbing them on the controller. This is also good,
because that kind of API is used in Rails code.
a392117
@drogus drogus Remove comment about getting rid of old AV::Base.new behavior
I've talked to José Valim, who added this comment, and there is no need
to remove old API. It's good to have a simple way to instantiate
ActionView::Base, by just passing view paths as a first argument,
instead of constructing LookupContext and then the Renderer.

[ci skip]
6aff0c6
Commits on Jun 15, 2012
@drogus drogus Do not add html format if user wants javascript
If a user wants javascript (ie. Accept: text/javascript) is sent, we
should not try to return HTML. It may be confusing and, what's even
more important, it's against HTTP spec.
3d908f0
@drogus drogus Remove mime types lookup from auto_discovery_link_tag
Automatically handling mime types for things other than :rss and :atom
is not functionality that justifies dependency on Mime::Type from
actionpack.
da28265
@drogus drogus Remove Mime::Type translations from Action View
Action View should not be responsible for translating mime types. Any
formats that are passed to Action View classes should be in form of
symbols, like :xml or :json. Any translation that's needed should be
handled at controller level.
ffbbcd8
@drogus drogus Add ActionView::Base.default_formats
default_formats array is used by LookupContext in order to allow
rendering templates when :formats option is not passed. Previously it
was always set to Mime::SET, which created dependency on Action Pack. In
order to remove this dependency, Mime::SET is used only if
ActionController is loaded.
36489be
Showing with 901 additions and 97 deletions.
  1. +2 −13 actionpack/Rakefile
  2. +1 −0  actionpack/actionpack.gemspec
  3. +11 −4 actionpack/lib/action_controller.rb
  4. +2 −2 actionpack/lib/action_controller/base.rb
  5. +15 −0 actionpack/lib/action_controller/metal/asset_paths.rb
  6. +3 −19 actionpack/lib/action_controller/vendor/html-scanner.rb
  7. +1 −1  actionpack/lib/action_dispatch/testing/assertions/dom.rb
  8. +1 −1  actionpack/lib/action_dispatch/testing/assertions/selector.rb
  9. +1 −1  actionpack/lib/action_dispatch/testing/assertions/tag.rb
  10. +1 −1  actionpack/lib/action_view/test_case.rb
  11. +1 −1  actionpack/test/controller/action_pack_assertions_test.rb
  12. +0 −1  actionpack/test/controller/caching_test.rb
  13. +1 −1  actionpack/test/controller/integration_test.rb
  14. +1 −6 actionpack/test/controller/mime_responds_test.rb
  15. +10 −0 actionpack/test/controller/render_js_test.rb
  16. +1 −1  actionpack/test/controller/selector_test.rb
  17. +0 −1  actionpack/test/fixtures/test/hello_world.erb~
  18. +0 −1  actionpack/test/fixtures/test/malformed/malformed.en.html.erb~
  19. +0 −1  actionpack/test/fixtures/test/malformed/malformed.erb~
  20. +0 −1  actionpack/test/fixtures/test/malformed/malformed.html.erb~
  21. 0  actionpack/test/fixtures/test/only_html.html.erb
  22. +3 −0  actionview/CHANGELOG.md
  23. +21 −0 actionview/MIT-LICENSE
  24. +31 −0 actionview/README.rdoc
  25. +27 −0 actionview/RUNNING_UNIT_TESTS
  26. +77 −0 actionview/Rakefile
  27. +27 −0 actionview/actionview.gemspec
  28. +1 −2  {actionpack → actionview}/lib/action_view.rb
  29. +3 −5 {actionpack → actionview}/lib/action_view/asset_paths.rb
  30. +3 −2 {actionpack → actionview}/lib/action_view/base.rb
  31. 0  {actionpack → actionview}/lib/action_view/buffers.rb
  32. 0  {actionpack → actionview}/lib/action_view/context.rb
  33. 0  {actionpack → actionview}/lib/action_view/flows.rb
  34. 0  {actionpack → actionview}/lib/action_view/helpers.rb
  35. 0  {actionpack → actionview}/lib/action_view/helpers/active_model_helper.rb
  36. +6 −1 {actionpack → actionview}/lib/action_view/helpers/asset_tag_helper.rb
  37. 0  {actionpack → actionview}/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
  38. 0  {actionpack → actionview}/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
  39. 0  {actionpack → actionview}/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb
  40. 0  {actionpack → actionview}/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  41. 0  {actionpack → actionview}/lib/action_view/helpers/atom_feed_helper.rb
  42. 0  {actionpack → actionview}/lib/action_view/helpers/benchmark_helper.rb
  43. 0  {actionpack → actionview}/lib/action_view/helpers/cache_helper.rb
  44. 0  {actionpack → actionview}/lib/action_view/helpers/capture_helper.rb
  45. 0  {actionpack → actionview}/lib/action_view/helpers/controller_helper.rb
  46. 0  {actionpack → actionview}/lib/action_view/helpers/csrf_helper.rb
  47. 0  {actionpack → actionview}/lib/action_view/helpers/date_helper.rb
  48. 0  {actionpack → actionview}/lib/action_view/helpers/debug_helper.rb
  49. 0  {actionpack → actionview}/lib/action_view/helpers/form_helper.rb
  50. 0  {actionpack → actionview}/lib/action_view/helpers/form_options_helper.rb
  51. 0  {actionpack → actionview}/lib/action_view/helpers/form_tag_helper.rb
  52. 0  {actionpack → actionview}/lib/action_view/helpers/javascript_helper.rb
  53. 0  {actionpack → actionview}/lib/action_view/helpers/number_helper.rb
  54. 0  {actionpack → actionview}/lib/action_view/helpers/output_safety_helper.rb
  55. +1 −3 {actionpack → actionview}/lib/action_view/helpers/record_tag_helper.rb
  56. 0  {actionpack → actionview}/lib/action_view/helpers/rendering_helper.rb
  57. +1 −1  {actionpack → actionview}/lib/action_view/helpers/sanitize_helper.rb
  58. 0  {actionpack → actionview}/lib/action_view/helpers/tag_helper.rb
  59. 0  {actionpack → actionview}/lib/action_view/helpers/tags.rb
  60. 0  {actionpack → actionview}/lib/action_view/helpers/tags/base.rb
  61. 0  {actionpack → actionview}/lib/action_view/helpers/tags/check_box.rb
  62. 0  {actionpack → actionview}/lib/action_view/helpers/tags/checkable.rb
  63. 0  {actionpack → actionview}/lib/action_view/helpers/tags/collection_check_boxes.rb
  64. 0  {actionpack → actionview}/lib/action_view/helpers/tags/collection_helpers.rb
  65. 0  {actionpack → actionview}/lib/action_view/helpers/tags/collection_radio_buttons.rb
  66. 0  {actionpack → actionview}/lib/action_view/helpers/tags/collection_select.rb
  67. 0  {actionpack → actionview}/lib/action_view/helpers/tags/color_field.rb
  68. 0  {actionpack → actionview}/lib/action_view/helpers/tags/date_field.rb
  69. 0  {actionpack → actionview}/lib/action_view/helpers/tags/date_select.rb
  70. 0  {actionpack → actionview}/lib/action_view/helpers/tags/datetime_field.rb
  71. 0  {actionpack → actionview}/lib/action_view/helpers/tags/datetime_local_field.rb
  72. 0  {actionpack → actionview}/lib/action_view/helpers/tags/datetime_select.rb
  73. 0  {actionpack → actionview}/lib/action_view/helpers/tags/email_field.rb
  74. 0  {actionpack → actionview}/lib/action_view/helpers/tags/file_field.rb
  75. 0  {actionpack → actionview}/lib/action_view/helpers/tags/grouped_collection_select.rb
  76. 0  {actionpack → actionview}/lib/action_view/helpers/tags/hidden_field.rb
  77. 0  {actionpack → actionview}/lib/action_view/helpers/tags/label.rb
  78. 0  {actionpack → actionview}/lib/action_view/helpers/tags/month_field.rb
  79. 0  {actionpack → actionview}/lib/action_view/helpers/tags/number_field.rb
  80. 0  {actionpack → actionview}/lib/action_view/helpers/tags/password_field.rb
  81. 0  {actionpack → actionview}/lib/action_view/helpers/tags/radio_button.rb
  82. 0  {actionpack → actionview}/lib/action_view/helpers/tags/range_field.rb
  83. 0  {actionpack → actionview}/lib/action_view/helpers/tags/search_field.rb
  84. 0  {actionpack → actionview}/lib/action_view/helpers/tags/select.rb
  85. 0  {actionpack → actionview}/lib/action_view/helpers/tags/tel_field.rb
  86. 0  {actionpack → actionview}/lib/action_view/helpers/tags/text_area.rb
  87. 0  {actionpack → actionview}/lib/action_view/helpers/tags/text_field.rb
  88. 0  {actionpack → actionview}/lib/action_view/helpers/tags/time_field.rb
  89. 0  {actionpack → actionview}/lib/action_view/helpers/tags/time_select.rb
  90. 0  {actionpack → actionview}/lib/action_view/helpers/tags/time_zone_select.rb
  91. 0  {actionpack → actionview}/lib/action_view/helpers/tags/url_field.rb
  92. 0  {actionpack → actionview}/lib/action_view/helpers/tags/week_field.rb
  93. 0  {actionpack → actionview}/lib/action_view/helpers/text_helper.rb
  94. 0  {actionpack → actionview}/lib/action_view/helpers/translation_helper.rb
  95. 0  {actionpack → actionview}/lib/action_view/helpers/url_helper.rb
  96. 0  {actionpack → actionview}/lib/action_view/locale/en.yml
  97. 0  {actionpack → actionview}/lib/action_view/log_subscriber.rb
  98. +1 −2  {actionpack → actionview}/lib/action_view/lookup_context.rb
  99. 0  {actionpack → actionview}/lib/action_view/path_set.rb
  100. 0  {actionpack → actionview}/lib/action_view/railtie.rb
  101. +1 −1  {actionpack/lib/action_controller → actionview/lib/action_view}/record_identifier.rb
  102. 0  {actionpack → actionview}/lib/action_view/renderer/abstract_renderer.rb
  103. 0  {actionpack → actionview}/lib/action_view/renderer/partial_renderer.rb
  104. 0  {actionpack → actionview}/lib/action_view/renderer/renderer.rb
  105. 0  {actionpack → actionview}/lib/action_view/renderer/streaming_template_renderer.rb
  106. 0  {actionpack → actionview}/lib/action_view/renderer/template_renderer.rb
  107. +3 −3 {actionpack → actionview}/lib/action_view/template.rb
  108. 0  {actionpack → actionview}/lib/action_view/template/error.rb
  109. 0  {actionpack → actionview}/lib/action_view/template/handlers.rb
  110. +1 −1  {actionpack → actionview}/lib/action_view/template/handlers/builder.rb
  111. 0  {actionpack → actionview}/lib/action_view/template/handlers/erb.rb
  112. 0  {actionpack → actionview}/lib/action_view/template/handlers/raw.rb
  113. +1 −1  {actionpack → actionview}/lib/action_view/template/resolver.rb
  114. +4 −5 {actionpack → actionview}/lib/action_view/template/text.rb
  115. 0  {actionpack → actionview}/lib/action_view/testing/resolvers.rb
  116. +20 −0 actionview/lib/action_view/vendor/html-scanner.rb
  117. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/document.rb
  118. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/node.rb
  119. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/sanitizer.rb
  120. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/selector.rb
  121. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/tokenizer.rb
  122. 0  {actionpack/lib/action_controller → actionview/lib/action_view}/vendor/html-scanner/html/version.rb
  123. +10 −0 actionview/lib/action_view/version.rb
  124. +361 −0 actionview/test/abstract_unit.rb
  125. 0  {actionpack → actionview}/test/active_record_unit.rb
  126. 0  {actionpack → actionview}/test/activerecord/active_record_store_test.rb
  127. 0  {actionpack → actionview}/test/activerecord/controller_runtime_test.rb
  128. 0  {actionpack → actionview}/test/activerecord/polymorphic_routes_test.rb
  129. 0  {actionpack → actionview}/test/activerecord/render_partial_with_record_identification_test.rb
  130. 0  {actionpack → actionview}/test/fixtures/_top_level_partial.html.erb
  131. +1 −0  actionview/test/fixtures/_top_level_partial_only.erb
  132. 0  {actionpack/test/fixtures/public → actionview/test/fixtures/blog_public}/.gitignore
  133. 0  {actionpack → actionview}/test/fixtures/blog_public/blog.html
  134. 0  {actionpack → actionview}/test/fixtures/blog_public/index.html
  135. 0  {actionpack → actionview}/test/fixtures/blog_public/subdir/index.html
  136. 0  {actionpack → actionview}/test/fixtures/comments/empty.de.html.erb
  137. 0  {actionpack → actionview}/test/fixtures/comments/empty.html.builder
  138. 0  {actionpack → actionview}/test/fixtures/comments/empty.html.erb
  139. 0  {actionpack → actionview}/test/fixtures/comments/empty.xml.erb
  140. 0  {actionpack → actionview}/test/fixtures/companies.yml
  141. +10 −0 actionview/test/fixtures/company.rb
  142. 0  {actionpack → actionview}/test/fixtures/custom_pattern/another.html.erb
  143. 0  {actionpack → actionview}/test/fixtures/custom_pattern/html/another.erb
  144. 0  {actionpack → actionview}/test/fixtures/custom_pattern/html/path.erb
  145. +1 −0  actionview/test/fixtures/customers/_customer.html.erb
  146. 0  {actionpack → actionview}/test/fixtures/db_definitions/sqlite.sql
  147. 0  {actionpack → actionview}/test/fixtures/developer.rb
  148. 0  {actionpack → actionview}/test/fixtures/developers.yml
  149. 0  {actionpack → actionview}/test/fixtures/developers/_developer.erb
  150. 0  {actionpack → actionview}/test/fixtures/developers_projects.yml
  151. 0  {actionpack → actionview}/test/fixtures/fun/games/_game.erb
  152. +1 −0  actionview/test/fixtures/fun/games/hello_world.erb
  153. 0  {actionpack → actionview}/test/fixtures/fun/serious/games/_game.erb
  154. 0  {actionpack → actionview}/test/fixtures/games/_game.erb
  155. +1 −0  actionview/test/fixtures/good_customers/_good_customer.html.erb
  156. 0  {actionpack → actionview}/test/fixtures/happy_path/render_action/hello_world.erb
  157. 0  {actionpack → actionview}/test/fixtures/layout_tests/alt/hello.erb
  158. 0  {actionpack → actionview}/test/fixtures/layouts/_column.html.erb
  159. +1 −0  actionview/test/fixtures/layouts/_customers.erb
  160. 0  {actionpack → actionview}/test/fixtures/layouts/_partial_and_yield.erb
  161. 0  {actionpack → actionview}/test/fixtures/layouts/_yield_only.erb
  162. 0  {actionpack → actionview}/test/fixtures/layouts/_yield_with_params.erb
  163. 0  {actionpack → actionview}/test/fixtures/layouts/streaming.erb
  164. +2 −0  actionview/test/fixtures/layouts/yield.erb
  165. 0  {actionpack → actionview}/test/fixtures/layouts/yield_with_render_inline_inside.erb
  166. 0  {actionpack → actionview}/test/fixtures/layouts/yield_with_render_partial_inside.erb
  167. 0  {actionpack → actionview}/test/fixtures/mascot.rb
  168. 0  {actionpack → actionview}/test/fixtures/mascots.yml
  169. 0  {actionpack → actionview}/test/fixtures/mascots/_mascot.html.erb
  170. 0  {actionpack → actionview}/test/fixtures/plain_text.raw
  171. 0  {actionpack → actionview}/test/fixtures/plain_text_with_characters.raw
  172. 0  {actionpack → actionview}/test/fixtures/project.rb
  173. 0  {actionpack → actionview}/test/fixtures/projects.yml
  174. 0  {actionpack → actionview}/test/fixtures/projects/_project.erb
  175. 0  {actionpack/test/fixtures/blog_public → actionview/test/fixtures/public}/.gitignore
  176. 0  {actionpack → actionview}/test/fixtures/public/elsewhere/cools.js
  177. 0  {actionpack → actionview}/test/fixtures/public/elsewhere/file.css
  178. 0  {actionpack → actionview}/test/fixtures/public/images/rails.png
  179. 0  {actionpack → actionview}/test/fixtures/public/javascripts/application.js
  180. 0  {actionpack → actionview}/test/fixtures/public/javascripts/bank.js
  181. 0  {actionpack → actionview}/test/fixtures/public/javascripts/common.javascript
  182. 0  {actionpack → actionview}/test/fixtures/public/javascripts/controls.js
  183. 0  {actionpack → actionview}/test/fixtures/public/javascripts/dragdrop.js
  184. 0  {actionpack → actionview}/test/fixtures/public/javascripts/effects.js
  185. 0  {actionpack → actionview}/test/fixtures/public/javascripts/prototype.js
  186. 0  {actionpack → actionview}/test/fixtures/public/javascripts/robber.js
  187. 0  {actionpack → actionview}/test/fixtures/public/javascripts/subdir/subdir.js
  188. 0  {actionpack → actionview}/test/fixtures/public/javascripts/version.1.0.js
  189. 0  {actionpack → actionview}/test/fixtures/public/stylesheets/bank.css
  190. 0  {actionpack → actionview}/test/fixtures/public/stylesheets/random.styles
  191. 0  {actionpack → actionview}/test/fixtures/public/stylesheets/robber.css
  192. 0  {actionpack → actionview}/test/fixtures/public/stylesheets/subdir/subdir.css
  193. 0  {actionpack → actionview}/test/fixtures/public/stylesheets/version.1.0.css
  194. 0  {actionpack → actionview}/test/fixtures/replies.yml
  195. 0  {actionpack → actionview}/test/fixtures/replies/_reply.erb
  196. 0  {actionpack → actionview}/test/fixtures/reply.rb
  197. 0  {actionpack → actionview}/test/fixtures/scope/test/modgreet.erb
  198. +1 −0  actionview/test/fixtures/shared.html.erb
  199. 0  {actionpack → actionview}/test/fixtures/test/_200.html.erb
  200. 0  {actionpack → actionview}/test/fixtures/test/_b_layout_for_partial.html.erb
  201. 0  {actionpack → actionview}/test/fixtures/test/_b_layout_for_partial_with_object.html.erb
  202. 0  {actionpack → actionview}/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb
  203. 0  {actionpack → actionview}/test/fixtures/test/_content_tag_nested_in_content_tag.erb
  204. +1 −0  actionview/test/fixtures/test/_counter.html.erb
  205. +1 −0  actionview/test/fixtures/test/_customer.erb
  206. +1 −0  actionview/test/fixtures/test/_customer_greeting.erb
  207. +1 −0  actionview/test/fixtures/test/_customer_with_var.erb
  208. 0  {actionpack → actionview}/test/fixtures/test/_from_helper.erb
  209. 0  {actionpack → actionview}/test/fixtures/test/_label_with_block.erb
  210. 0  {actionpack → actionview}/test/fixtures/test/_layout_for_block_with_args.html.erb
  211. +3 −0  actionview/test/fixtures/test/_layout_for_partial.html.erb
  212. 0  {actionpack → actionview}/test/fixtures/test/_layout_with_partial_and_yield.html.erb
  213. 0  {actionpack → actionview}/test/fixtures/test/_local_inspector.html.erb
  214. 0  {actionpack → actionview}/test/fixtures/test/_object_inspector.erb
  215. 0  {actionpack → actionview}/test/fixtures/test/_one.html.erb
  216. +1 −0  actionview/test/fixtures/test/_partial.erb
  217. +1 −0  actionview/test/fixtures/test/_partial.html.erb
  218. +1 −0  actionview/test/fixtures/test/_partial.js.erb
  219. +1 −0  actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb
  220. +1 −0  actionview/test/fixtures/test/_partial_only.erb
  221. 0  {actionpack → actionview}/test/fixtures/test/_partial_with_layout.erb
  222. 0  {actionpack → actionview}/test/fixtures/test/_partial_with_layout_block_content.erb
  223. 0  {actionpack → actionview}/test/fixtures/test/_partial_with_layout_block_partial.erb
  224. 0  {actionpack → actionview}/test/fixtures/test/_partial_with_only_html_version.html.erb
  225. 0  {actionpack → actionview}/test/fixtures/test/_partial_with_partial.erb
  226. 0  {actionpack → actionview}/test/fixtures/test/_raise.html.erb
  227. 0  {actionpack → actionview}/test/fixtures/test/_two.html.erb
  228. 0  {actionpack → actionview}/test/fixtures/test/_utf8_partial.html.erb
  229. 0  {actionpack → actionview}/test/fixtures/test/_utf8_partial_magic.html.erb
  230. 0  {actionpack → actionview}/test/fixtures/test/basic.html.erb
  231. +1 −0  actionview/test/fixtures/test/calling_partial_with_layout.html.erb
  232. 0  {actionpack → actionview}/test/fixtures/test/dont_pick_me
  233. +1 −0  actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb
  234. +1 −0  actionview/test/fixtures/test/greeting.xml.erb
  235. +4 −0 actionview/test/fixtures/test/hello.builder
  236. 0  {actionpack → actionview}/test/fixtures/test/hello_world.da.html.erb
  237. +1 −0  actionview/test/fixtures/test/hello_world.erb
  238. 0  {actionpack → actionview}/test/fixtures/test/hello_world.pt-BR.html.erb
  239. 0  {actionpack → actionview}/test/fixtures/test/layout_render_file.erb
  240. 0  {actionpack → actionview}/test/fixtures/test/layout_render_object.erb
  241. +1 −0  actionview/test/fixtures/test/list.erb
  242. 0  {actionpack → actionview}/test/fixtures/test/nested_layout.erb
  243. 0  {actionpack → actionview}/test/fixtures/test/nested_streaming.erb
  244. 0  {actionpack → actionview}/test/fixtures/test/one.html.erb
  245. +1 −0  actionview/test/fixtures/test/render_file_with_ivar.erb
  246. +1 −0  actionview/test/fixtures/test/render_file_with_locals.erb
  247. +1 −0  actionview/test/fixtures/test/render_file_with_locals_and_default.erb
  248. 0  {actionpack → actionview}/test/fixtures/test/streaming.erb
  249. 0  {actionpack → actionview}/test/fixtures/test/streaming_buster.erb
  250. 0  {actionpack → actionview}/test/fixtures/test/sub_template_raise.html.erb
  251. 0  {actionpack → actionview}/test/fixtures/test/template.erb
  252. 0  {actionpack → actionview}/test/fixtures/test/update_element_with_capture.erb
  253. 0  {actionpack → actionview}/test/fixtures/test/utf8.html.erb
  254. 0  {actionpack → actionview}/test/fixtures/test/utf8_magic.html.erb
  255. 0  {actionpack → actionview}/test/fixtures/test/utf8_magic_with_bare_partial.html.erb
  256. 0  {actionpack → actionview}/test/fixtures/topic.rb
  257. 0  {actionpack → actionview}/test/fixtures/topics.yml
  258. 0  {actionpack → actionview}/test/fixtures/topics/_topic.html.erb
  259. 0  {actionpack → actionview}/test/fixtures/translations/templates/array.erb
  260. 0  {actionpack → actionview}/test/fixtures/translations/templates/default.erb
  261. 0  {actionpack → actionview}/test/fixtures/translations/templates/found.erb
  262. 0  {actionpack → actionview}/test/fixtures/translations/templates/missing.erb
  263. 0  {actionpack → actionview}/test/fixtures/with_format.json.erb
  264. +185 −0 actionview/test/lib/controller/fake_models.rb
  265. 0  {actionpack → actionview}/test/template/active_model_helper_test.rb
  266. +0 −1  {actionpack → actionview}/test/template/asset_tag_helper_test.rb
  267. 0  {actionpack → actionview}/test/template/atom_feed_helper_test.rb
  268. 0  {actionpack → actionview}/test/template/benchmark_helper_test.rb
  269. 0  {actionpack → actionview}/test/template/capture_helper_test.rb
  270. +0 −1  {actionpack → actionview}/test/template/compiled_templates_test.rb
  271. 0  {actionpack → actionview}/test/template/date_helper_i18n_test.rb
  272. 0  {actionpack → actionview}/test/template/date_helper_test.rb
  273. 0  {actionpack → actionview}/test/template/erb/form_for_test.rb
  274. 0  {actionpack → actionview}/test/template/erb/helper.rb
  275. 0  {actionpack → actionview}/test/template/erb/tag_helper_test.rb
  276. 0  {actionpack → actionview}/test/template/erb_util_test.rb
  277. 0  {actionpack → actionview}/test/template/form_collections_helper_test.rb
  278. 0  {actionpack → actionview}/test/template/form_helper_test.rb
  279. 0  {actionpack → actionview}/test/template/form_options_helper_i18n_test.rb
  280. 0  {actionpack → actionview}/test/template/form_options_helper_test.rb
  281. 0  {actionpack → actionview}/test/template/form_tag_helper_test.rb
  282. 0  {actionpack → actionview}/test/template/html-scanner/cdata_node_test.rb
  283. 0  {actionpack → actionview}/test/template/html-scanner/document_test.rb
  284. 0  {actionpack → actionview}/test/template/html-scanner/node_test.rb
  285. 0  {actionpack → actionview}/test/template/html-scanner/sanitizer_test.rb
  286. 0  {actionpack → actionview}/test/template/html-scanner/tag_node_test.rb
  287. 0  {actionpack → actionview}/test/template/html-scanner/text_node_test.rb
  288. 0  {actionpack → actionview}/test/template/html-scanner/tokenizer_test.rb
  289. 0  {actionpack → actionview}/test/template/javascript_helper_test.rb
  290. +4 −3 {actionpack → actionview}/test/template/log_subscriber_test.rb
  291. +14 −8 {actionpack → actionview}/test/template/lookup_context_test.rb
  292. 0  {actionpack → actionview}/test/template/number_helper_i18n_test.rb
  293. 0  {actionpack → actionview}/test/template/number_helper_test.rb
  294. 0  {actionpack → actionview}/test/template/output_buffer_test.rb
  295. 0  {actionpack → actionview}/test/template/output_safety_helper_test.rb
  296. +1 −1  {actionpack/test/controller → actionview/test/template}/record_identifier_test.rb
  297. 0  {actionpack → actionview}/test/template/record_tag_helper_test.rb
  298. 0  {actionpack → actionview}/test/template/render_test.rb
  299. 0  {actionpack → actionview}/test/template/resolver_patterns_test.rb
  300. 0  {actionpack → actionview}/test/template/sanitize_helper_test.rb
Sorry, we could not display the entire diff because too many files (325) changed.
View
15 actionpack/Rakefile
@@ -8,14 +8,14 @@ task :default => :test
# Run the unit tests
desc "Run all unit tests"
-task :test => [:test_action_pack, :test_active_record_integration]
+task :test => [:test_action_pack]
Rake::TestTask.new(:test_action_pack) do |t|
t.libs << 'test'
# make sure we include the tests in alphabetical order as on some systems
# this will not happen automatically and the tests (as a whole) will error
- t.test_files = Dir.glob('test/{abstract,controller,dispatch,template,assertions}/**/*_test.rb').sort
+ t.test_files = Dir.glob('test/{abstract,controller,dispatch,assertions}/**/*_test.rb').sort
t.warning = true
t.verbose = true
@@ -26,17 +26,6 @@ namespace :test do
t.libs << 'test'
t.pattern = 'test/ts_isolated.rb'
end
-
- Rake::TestTask.new(:template) do |t|
- t.libs << 'test'
- t.pattern = 'test/template/**/*.rb'
- end
-end
-
-desc 'ActiveRecord Integration Tests'
-Rake::TestTask.new(:test_active_record_integration) do |t|
- t.libs << 'test'
- t.test_files = Dir.glob("test/activerecord/*_test.rb")
end
spec = eval(File.read('actionpack.gemspec'))
View
1  actionpack/actionpack.gemspec
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
+ s.add_dependency('actionview', version)
s.add_dependency('rack-cache', '~> 1.2')
s.add_dependency('builder', '~> 3.0.0')
s.add_dependency('rack', '~> 1.4.1')
View
15 actionpack/lib/action_controller.rb
@@ -10,6 +10,7 @@ module ActionController
autoload :Middleware
autoload_under "metal" do
+ autoload :AssetPaths
autoload :Compatibility
autoload :ConditionalGet
autoload :Cookies
@@ -42,15 +43,21 @@ module ActionController
autoload :Routing, 'action_controller/deprecated'
autoload :TestCase, 'action_controller/test_case'
autoload :TemplateAssertions, 'action_controller/test_case'
+end
+
+# All of these simply register additional autoloads
+require 'action_view'
+require 'action_view/vendor/html-scanner'
+# ActionView::TestCase is located in actionpack gem,
+# so we can't load it in action_view.rb
+module ActionView
eager_autoload do
- autoload :RecordIdentifier
+ autoload :TestCase
end
end
-# All of these simply register additional autoloads
-require 'action_view'
-require 'action_controller/vendor/html-scanner'
+ActionView::Base.default_formats ||= Mime::SET.symbols
# Common Active Support usage in Action Controller
require 'active_support/concern'
View
4 actionpack/lib/action_controller/base.rb
@@ -192,8 +192,8 @@ def self.without_modules(*modules)
MODULES = [
AbstractController::Layouts,
AbstractController::Translation,
- AbstractController::AssetPaths,
+ AssetPaths,
Helpers,
HideActions,
UrlFor,
@@ -212,7 +212,7 @@ def self.without_modules(*modules)
ForceSSL,
Streaming,
DataStreaming,
- RecordIdentifier,
+ ActionView::RecordIdentifier,
HttpAuthentication::Basic::ControllerMethods,
HttpAuthentication::Digest::ControllerMethods,
HttpAuthentication::Token::ControllerMethods,
View
15 actionpack/lib/action_controller/metal/asset_paths.rb
@@ -0,0 +1,15 @@
+require 'action_controller/metal/exceptions'
+
+module ActionController
+ module AssetPaths
+ extend ActiveSupport::Concern
+
+ included do
+ include AbstractController::AssetPaths
+ end
+
+ def invalid_asset_host!(help_message)
+ raise ActionController::RoutingError, "This asset host cannot be computed without a request in scope. #{help_message}"
+ end
+ end
+end
View
22 actionpack/lib/action_controller/vendor/html-scanner.rb
@@ -1,20 +1,4 @@
-$LOAD_PATH << "#{File.dirname(__FILE__)}/html-scanner"
+require 'action_view/vendor/html-scanner'
+require 'active_support/deprecation'
-module HTML
- extend ActiveSupport::Autoload
-
- eager_autoload do
- autoload :CDATA, 'html/node'
- autoload :Document, 'html/document'
- autoload :FullSanitizer, 'html/sanitizer'
- autoload :LinkSanitizer, 'html/sanitizer'
- autoload :Node, 'html/node'
- autoload :Sanitizer, 'html/sanitizer'
- autoload :Selector, 'html/selector'
- autoload :Tag, 'html/node'
- autoload :Text, 'html/node'
- autoload :Tokenizer, 'html/tokenizer'
- autoload :Version, 'html/version'
- autoload :WhiteListSanitizer, 'html/sanitizer'
- end
-end
+ActiveSupport::Deprecation.warn 'vendored html-scanner was moved to action_view, please require "action_view/vendor/html-scanner" instead'
View
2  actionpack/lib/action_dispatch/testing/assertions/dom.rb
@@ -1,4 +1,4 @@
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
module ActionDispatch
module Assertions
View
2  actionpack/lib/action_dispatch/testing/assertions/selector.rb
@@ -1,4 +1,4 @@
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
require 'active_support/core_ext/object/inclusion'
#--
View
2  actionpack/lib/action_dispatch/testing/assertions/tag.rb
@@ -1,4 +1,4 @@
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
module ActionDispatch
module Assertions
View
2  actionpack/lib/action_view/test_case.rb
@@ -40,10 +40,10 @@ module Behavior
include ActionView::Context
include ActionDispatch::Routing::PolymorphicRoutes
- include ActionController::RecordIdentifier
include AbstractController::Helpers
include ActionView::Helpers
+ include ActionView::RecordIdentifier
delegate :lookup_context, :to => :controller
attr_accessor :controller, :output_buffer, :rendered
View
2  actionpack/test/controller/action_pack_assertions_test.rb
@@ -1,5 +1,5 @@
require 'abstract_unit'
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
require 'controller/fake_controllers'
class ActionPackAssertionsController < ActionController::Base
View
1  actionpack/test/controller/caching_test.rb
@@ -1,6 +1,5 @@
require 'fileutils'
require 'abstract_unit'
-require 'active_record_unit'
CACHE_DIR = 'test_cache'
# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed
View
2  actionpack/test/controller/integration_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'
require 'controller/fake_controllers'
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
class SessionTest < ActiveSupport::TestCase
StubApp = lambda { |env|
View
7 actionpack/test/controller/mime_responds_test.rb
@@ -240,7 +240,7 @@ def test_js_or_html
assert_equal 'HTML', @response.body
@request.accept = "text/javascript, text/html"
-
+
assert_raises(ActionController::UnknownFormat) do
xhr :get, :just_xml
end
@@ -1187,11 +1187,6 @@ def test_format_with_inherited_layouts
get :index
assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body
end
-
- def test_non_navigational_format_with_no_template_fallbacks_to_html_template_with_no_layout
- get :index, :format => :js
- assert_equal "Hello Firefox", @response.body
- end
end
class FlashResponder < ActionController::Responder
View
10 actionpack/test/controller/render_js_test.rb
@@ -17,6 +17,10 @@ def render_vanilla_js_hello
def show_partial
render :partial => 'partial'
end
+
+ def only_html
+ render
+ end
end
tests TestController
@@ -31,4 +35,10 @@ def test_should_render_js_partial
xhr :get, :show_partial, :format => 'js'
assert_equal 'partial js', @response.body
end
+
+ def test_should_not_render_html_if_only_js_is_passed
+ assert_raise(ActionView::MissingTemplate) {
+ get :only_html, :format => 'js'
+ }
+ end
end
View
2  actionpack/test/controller/selector_test.rb
@@ -5,7 +5,7 @@
require 'abstract_unit'
require 'controller/fake_controllers'
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
class SelectorTest < ActiveSupport::TestCase
#
View
1  actionpack/test/fixtures/test/hello_world.erb~
@@ -1 +0,0 @@
-Don't pick me!
View
1  actionpack/test/fixtures/test/malformed/malformed.en.html.erb~
@@ -1 +0,0 @@
-Don't render me!
View
1  actionpack/test/fixtures/test/malformed/malformed.erb~
@@ -1 +0,0 @@
-Don't render me!
View
1  actionpack/test/fixtures/test/malformed/malformed.html.erb~
@@ -1 +0,0 @@
-Don't render me!
View
0  actionpack/test/fixtures/test/only_html.html.erb
No changes.
View
3  actionview/CHANGELOG.md
@@ -0,0 +1,3 @@
+## Rails 4.0.0 (unreleased) ##
+
+* First public release
View
21 actionview/MIT-LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2004-2012 David Heinemeier Hansson
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
31 actionview/README.rdoc
@@ -0,0 +1,31 @@
+= Action View
+
+
+
+== Download and installation
+
+The latest version of Action View can be installed with RubyGems:
+
+ % [sudo] gem install actionview
+
+Source code can be downloaded as part of the Rails project on GitHub
+
+* https://github.com/rails/rails/tree/master/actionview
+
+
+== License
+
+Action View is released under the MIT license:
+
+* http://www.opensource.org/licenses/MIT
+
+
+== Support
+
+API documentation is at
+
+* http://api.rubyonrails.org
+
+Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
+
+* https://github.com/rails/rails/issues
View
27 actionview/RUNNING_UNIT_TESTS
@@ -0,0 +1,27 @@
+== Running with Rake
+
+The easiest way to run the unit tests is through Rake. The default task runs
+the entire test suite for all classes. For more information, checkout the
+full array of rake tasks with "rake -T"
+
+Rake can be found at http://rake.rubyforge.org
+
+== Running by hand
+
+To run a single test suite
+
+ rake test TEST=path/to/test.rb
+
+which can be further narrowed down to one test:
+
+ rake test TEST=path/to/test.rb TESTOPTS="--name=test_something"
+
+== Dependency on Active Record and database setup
+
+Test cases in the test/active_record/ directory depend on having
+activerecord and sqlite installed. If Active Record is not in
+actionpack/../activerecord directory, or the sqlite rubygem is not installed,
+these tests are skipped.
+
+Other tests are runnable from a fresh copy of actionpack without any configuration.
+
View
77 actionview/Rakefile
@@ -0,0 +1,77 @@
+require 'rake/testtask'
+require 'rake/packagetask'
+require 'rubygems/package_task'
+
+desc "Default Task"
+task :default => :test
+
+# Run the unit tests
+
+desc "Run all unit tests"
+task :test => [:test_action_view, :test_active_record_integration]
+
+Rake::TestTask.new(:test_action_view) do |t|
+ t.libs << 'test'
+
+ # make sure we include the tests in alphabetical order as on some systems
+ # this will not happen automatically and the tests (as a whole) will error
+ t.test_files = Dir.glob('test/template/**/*_test.rb').sort
+
+ t.warning = true
+ t.verbose = true
+end
+
+namespace :test do
+ Rake::TestTask.new(:isolated) do |t|
+ t.libs << 'test'
+ t.pattern = 'test/ts_isolated.rb'
+ end
+
+ Rake::TestTask.new(:template) do |t|
+ t.libs << 'test'
+ t.pattern = 'test/template/**/*.rb'
+ end
+end
+
+desc 'ActiveRecord Integration Tests'
+Rake::TestTask.new(:test_active_record_integration) do |t|
+ t.libs << 'test'
+ t.test_files = Dir.glob("test/activerecord/*_test.rb")
+end
+
+spec = eval(File.read('actionview.gemspec'))
+
+Gem::PackageTask.new(spec) do |p|
+ p.gem_spec = spec
+end
+
+desc "Release to gemcutter"
+task :release => :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
+end
+
+task :lines do
+ lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
+
+ FileList["lib/**/*.rb"].each do |file_name|
+ next if file_name =~ /vendor/
+ File.open(file_name, 'r') do |f|
+ while line = f.gets
+ lines += 1
+ next if line =~ /^\s*$/
+ next if line =~ /^\s*#/
+ codelines += 1
+ end
+ end
+ puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
+
+ total_lines += lines
+ total_codelines += codelines
+
+ lines, codelines = 0, 0
+ end
+
+ puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
+end
View
27 actionview/actionview.gemspec
@@ -0,0 +1,27 @@
+version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip
+
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = 'actionview'
+ s.version = version
+ s.summary = 'Rendering framework putting the V in MVC (part of Rails).'
+ s.description = ''
+ s.required_ruby_version = '>= 1.9.3'
+ s.license = 'MIT'
+
+ s.author = 'David Heinemeier Hansson'
+ s.email = 'david@loudthinking.com'
+ s.homepage = 'http://www.rubyonrails.org'
+
+ s.files = Dir['CHANGELOG.md', 'README.rdoc', 'MIT-LICENSE', 'lib/**/*']
+ s.require_path = 'lib'
+ s.requirements << 'none'
+
+ s.add_dependency('activesupport', version)
+ s.add_dependency('activemodel', version)
+ s.add_dependency('builder', '~> 3.0.0')
+ s.add_dependency('erubis', '~> 2.7.0')
+
+ s.add_development_dependency('tzinfo', '~> 0.3.29')
+ s.add_development_dependency('actionpack', version)
+end
View
3  actionpack/lib/action_view.rb → actionview/lib/action_view.rb
@@ -22,7 +22,6 @@
#++
require 'active_support'
-require 'action_pack'
module ActionView
extend ActiveSupport::Autoload
@@ -35,8 +34,8 @@ module ActionView
autoload :Helpers
autoload :LookupContext
autoload :PathSet
+ autoload :RecordIdentifier
autoload :Template
- autoload :TestCase
autoload_under "renderer" do
autoload :Renderer
View
8 actionpack/lib/action_view/asset_paths.rb → actionview/lib/action_view/asset_paths.rb
@@ -1,6 +1,6 @@
require 'zlib'
require 'active_support/core_ext/file'
-require 'action_controller/metal/exceptions'
+require 'active_support/core_ext/module/delegation'
module ActionView
class AssetPaths #:nodoc:
@@ -8,6 +8,8 @@ class AssetPaths #:nodoc:
attr_reader :config, :controller
+ delegate :invalid_asset_host!, :to => :controller, :prefix => false
+
def initialize(config, controller = nil)
@config = config
@controller = controller
@@ -91,10 +93,6 @@ def default_protocol
@config.default_asset_host_protocol || (has_request? ? :request : :relative)
end
- def invalid_asset_host!(help_message)
- raise ActionController::RoutingError, "This asset host cannot be computed without a request in scope. #{help_message}"
- end
-
# Pick an asset host for this source. Returns +nil+ if no host is set,
# the host if no wildcard is set, the host interpolated with the
# numbers 0-3 if it contains <tt>%d</tt> (the number is the source hash mod 4),
View
5 actionpack/lib/action_view/base.rb → actionview/lib/action_view/base.rb
@@ -148,6 +148,9 @@ class Base
cattr_accessor :prefix_partial_path_with_controller_namespace
@@prefix_partial_path_with_controller_namespace = true
+ # Specify default_formats that can be rendered.
+ cattr_accessor :default_formats
+
class_attribute :helpers
class_attribute :_routes
class_attribute :logger
@@ -197,8 +200,6 @@ def assign(new_assigns) # :nodoc:
def initialize(context = nil, assigns = {}, controller = nil, formats = nil) #:nodoc:
@_config = ActiveSupport::InheritableOptions.new
- # Handle all these for backwards compatibility.
- # TODO Provide a new API for AV::Base and deprecate this one.
if context.is_a?(ActionView::Renderer)
@view_renderer = context
else
View
0  actionpack/lib/action_view/buffers.rb → actionview/lib/action_view/buffers.rb
File renamed without changes
View
0  actionpack/lib/action_view/context.rb → actionview/lib/action_view/context.rb
File renamed without changes
View
0  actionpack/lib/action_view/flows.rb → actionview/lib/action_view/flows.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers.rb → actionview/lib/action_view/helpers.rb
File renamed without changes
View
0  ...ck/lib/action_view/helpers/active_model_helper.rb → ...ew/lib/action_view/helpers/active_model_helper.rb
File renamed without changes
View
7 ...npack/lib/action_view/helpers/asset_tag_helper.rb → ...nview/lib/action_view/helpers/asset_tag_helper.rb
@@ -222,10 +222,15 @@ module AssetTagHelper
# auto_discovery_link_tag(:rss, "http://www.example.com/feed.rss", {:title => "Example RSS"}) # =>
# <link rel="alternate" type="application/rss+xml" title="Example RSS" href="http://www.example.com/feed" />
def auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})
+ if !(type == :rss || type == :atom) && tag_options[:type].blank?
+ raise ArgumentError, "You have passed type other than :rss or :atom to auto_discovery_link_tag and haven't supplied " +
+ "the :type option key. You need to pass :type explicitly if you want to use other types"
+ end
+
tag(
"link",
"rel" => tag_options[:rel] || "alternate",
- "type" => tag_options[:type] || Mime::Type.lookup_by_extension(type.to_s).to_s,
+ "type" => tag_options[:type] || "application/#{type}+xml",
"title" => tag_options[:title] || type.to_s.upcase,
"href" => url_options.is_a?(Hash) ? url_for(url_options.merge(:only_path => false)) : url_options
)
View
0  ...ew/helpers/asset_tag_helpers/asset_include_tag.rb → ...ew/helpers/asset_tag_helpers/asset_include_tag.rb
File renamed without changes
View
0  ...ion_view/helpers/asset_tag_helpers/asset_paths.rb → ...ion_view/helpers/asset_tag_helpers/asset_paths.rb
File renamed without changes
View
0  ...lpers/asset_tag_helpers/javascript_tag_helpers.rb → ...lpers/asset_tag_helpers/javascript_tag_helpers.rb
File renamed without changes
View
0  ...lpers/asset_tag_helpers/stylesheet_tag_helpers.rb → ...lpers/asset_tag_helpers/stylesheet_tag_helpers.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/atom_feed_helper.rb → ...nview/lib/action_view/helpers/atom_feed_helper.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/benchmark_helper.rb → ...nview/lib/action_view/helpers/benchmark_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/cache_helper.rb → actionview/lib/action_view/helpers/cache_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/capture_helper.rb → actionview/lib/action_view/helpers/capture_helper.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/controller_helper.rb → ...view/lib/action_view/helpers/controller_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/csrf_helper.rb → actionview/lib/action_view/helpers/csrf_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/date_helper.rb → actionview/lib/action_view/helpers/date_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/debug_helper.rb → actionview/lib/action_view/helpers/debug_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/form_helper.rb → actionview/lib/action_view/helpers/form_helper.rb
File renamed without changes
View
0  ...ck/lib/action_view/helpers/form_options_helper.rb → ...ew/lib/action_view/helpers/form_options_helper.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/form_tag_helper.rb → ...onview/lib/action_view/helpers/form_tag_helper.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/javascript_helper.rb → ...view/lib/action_view/helpers/javascript_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/number_helper.rb → actionview/lib/action_view/helpers/number_helper.rb
File renamed without changes
View
0  ...k/lib/action_view/helpers/output_safety_helper.rb → ...w/lib/action_view/helpers/output_safety_helper.rb
File renamed without changes
View
4 ...pack/lib/action_view/helpers/record_tag_helper.rb → ...view/lib/action_view/helpers/record_tag_helper.rb
@@ -1,10 +1,8 @@
-require 'action_controller/record_identifier'
-
module ActionView
# = Action View Record Tag Helpers
module Helpers
module RecordTagHelper
- include ActionController::RecordIdentifier
+ include ActionView::RecordIdentifier
# Produces a wrapper DIV element with id and class parameters that
# relate to the specified Active Record object. Usage example:
View
0  ...npack/lib/action_view/helpers/rendering_helper.rb → ...nview/lib/action_view/helpers/rendering_helper.rb
File renamed without changes
View
2  ...onpack/lib/action_view/helpers/sanitize_helper.rb → ...onview/lib/action_view/helpers/sanitize_helper.rb
@@ -1,5 +1,5 @@
require 'active_support/core_ext/object/try'
-require 'action_controller/vendor/html-scanner'
+require 'action_view/vendor/html-scanner'
module ActionView
# = Action View Sanitize Helpers
View
0  actionpack/lib/action_view/helpers/tag_helper.rb → actionview/lib/action_view/helpers/tag_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags.rb → actionview/lib/action_view/helpers/tags.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/base.rb → actionview/lib/action_view/helpers/tags/base.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/check_box.rb → actionview/lib/action_view/helpers/tags/check_box.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/checkable.rb → actionview/lib/action_view/helpers/tags/checkable.rb
File renamed without changes
View
0  ...ction_view/helpers/tags/collection_check_boxes.rb → ...ction_view/helpers/tags/collection_check_boxes.rb
File renamed without changes
View
0  ...ib/action_view/helpers/tags/collection_helpers.rb → ...ib/action_view/helpers/tags/collection_helpers.rb
File renamed without changes
View
0  ...ion_view/helpers/tags/collection_radio_buttons.rb → ...ion_view/helpers/tags/collection_radio_buttons.rb
File renamed without changes
View
0  ...lib/action_view/helpers/tags/collection_select.rb → ...lib/action_view/helpers/tags/collection_select.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/color_field.rb → ...nview/lib/action_view/helpers/tags/color_field.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/tags/date_field.rb → ...onview/lib/action_view/helpers/tags/date_field.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/date_select.rb → ...nview/lib/action_view/helpers/tags/date_select.rb
File renamed without changes
View
0  ...ck/lib/action_view/helpers/tags/datetime_field.rb → ...ew/lib/action_view/helpers/tags/datetime_field.rb
File renamed without changes
View
0  .../action_view/helpers/tags/datetime_local_field.rb → .../action_view/helpers/tags/datetime_local_field.rb
File renamed without changes
View
0  ...k/lib/action_view/helpers/tags/datetime_select.rb → ...w/lib/action_view/helpers/tags/datetime_select.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/email_field.rb → ...nview/lib/action_view/helpers/tags/email_field.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/tags/file_field.rb → ...onview/lib/action_view/helpers/tags/file_field.rb
File renamed without changes
View
0  ...on_view/helpers/tags/grouped_collection_select.rb → ...on_view/helpers/tags/grouped_collection_select.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/tags/hidden_field.rb → ...view/lib/action_view/helpers/tags/hidden_field.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/label.rb → actionview/lib/action_view/helpers/tags/label.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/month_field.rb → ...nview/lib/action_view/helpers/tags/month_field.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/tags/number_field.rb → ...view/lib/action_view/helpers/tags/number_field.rb
File renamed without changes
View
0  ...ck/lib/action_view/helpers/tags/password_field.rb → ...ew/lib/action_view/helpers/tags/password_field.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/tags/radio_button.rb → ...view/lib/action_view/helpers/tags/radio_button.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/range_field.rb → ...nview/lib/action_view/helpers/tags/range_field.rb
File renamed without changes
View
0  ...pack/lib/action_view/helpers/tags/search_field.rb → ...view/lib/action_view/helpers/tags/search_field.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/select.rb → actionview/lib/action_view/helpers/tags/select.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/tel_field.rb → actionview/lib/action_view/helpers/tags/tel_field.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/text_area.rb → actionview/lib/action_view/helpers/tags/text_area.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/tags/text_field.rb → ...onview/lib/action_view/helpers/tags/text_field.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/tags/time_field.rb → ...onview/lib/action_view/helpers/tags/time_field.rb
File renamed without changes
View
0  ...npack/lib/action_view/helpers/tags/time_select.rb → ...nview/lib/action_view/helpers/tags/time_select.rb
File renamed without changes
View
0  .../lib/action_view/helpers/tags/time_zone_select.rb → .../lib/action_view/helpers/tags/time_zone_select.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/tags/url_field.rb → actionview/lib/action_view/helpers/tags/url_field.rb
File renamed without changes
View
0  ...onpack/lib/action_view/helpers/tags/week_field.rb → ...onview/lib/action_view/helpers/tags/week_field.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/text_helper.rb → actionview/lib/action_view/helpers/text_helper.rb
File renamed without changes
View
0  ...ack/lib/action_view/helpers/translation_helper.rb → ...iew/lib/action_view/helpers/translation_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/helpers/url_helper.rb → actionview/lib/action_view/helpers/url_helper.rb
File renamed without changes
View
0  actionpack/lib/action_view/locale/en.yml → actionview/lib/action_view/locale/en.yml
File renamed without changes
View
0  actionpack/lib/action_view/log_subscriber.rb → actionview/lib/action_view/log_subscriber.rb
File renamed without changes
View
3  actionpack/lib/action_view/lookup_context.rb → actionview/lib/action_view/lookup_context.rb
@@ -44,7 +44,7 @@ module Accessors #:nodoc:
end
register_detail(:locale) { [I18n.locale, I18n.default_locale].uniq }
- register_detail(:formats) { Mime::SET.symbols }
+ register_detail(:formats) { ActionView::Base.default_formats || [:html, :text, :js, :css, :xml, :json] }
register_detail(:handlers){ Template::Handlers.extensions }
class DetailsKey #:nodoc:
@@ -184,7 +184,6 @@ def initialize(view_paths, details = {}, prefixes = [])
def formats=(values)
if values
values.concat(default_formats) if values.delete "*/*"
- values << :html if values == [:js]
end
super(values)
end
View
0  actionpack/lib/action_view/path_set.rb → actionview/lib/action_view/path_set.rb
File renamed without changes
View
0  actionpack/lib/action_view/railtie.rb → actionview/lib/action_view/railtie.rb
File renamed without changes
View
2  ...onpack/lib/action_controller/record_identifier.rb → actionview/lib/action_view/record_identifier.rb
@@ -1,6 +1,6 @@
require 'active_support/core_ext/module'
-module ActionController
+module ActionView
# The record identifier encapsulates a number of naming conventions for dealing with records, like Active Records or
# pretty much any other model type that has an id. These patterns are then used to try elevate the view actions to
# a higher logical level.
View
0  ...ack/lib/action_view/renderer/abstract_renderer.rb → ...iew/lib/action_view/renderer/abstract_renderer.rb
File renamed without changes
View
0  ...pack/lib/action_view/renderer/partial_renderer.rb → ...view/lib/action_view/renderer/partial_renderer.rb
File renamed without changes
View
0  actionpack/lib/action_view/renderer/renderer.rb → actionview/lib/action_view/renderer/renderer.rb
File renamed without changes
View
0  ...tion_view/renderer/streaming_template_renderer.rb → ...tion_view/renderer/streaming_template_renderer.rb
File renamed without changes
View
0  ...ack/lib/action_view/renderer/template_renderer.rb → ...iew/lib/action_view/renderer/template_renderer.rb
File renamed without changes
View
6 actionpack/lib/action_view/template.rb → actionview/lib/action_view/template.rb
@@ -122,7 +122,7 @@ def initialize(source, identifier, handler, details)
@locals = details[:locals] || []
@virtual_path = details[:virtual_path]
@updated_at = details[:updated_at] || Time.now
- @formats = Array(format).map { |f| f.is_a?(Mime::Type) ? f.ref : f }
+ @formats = Array(format).map { |f| f.to_sym }
@compile_mutex = Mutex.new
end
@@ -147,8 +147,8 @@ def render(view, locals, buffer=nil, &block)
handle_render_error(view, e)
end
- def mime_type
- @mime_type ||= Mime::Type.lookup_by_extension(@formats.first.to_s) if @formats.first
+ def type
+ @type ||= @formats.first.to_sym if @formats.first
end
# Receives a view object and return a template similar to self by using @virtual_path.
View
0  actionpack/lib/action_view/template/error.rb → actionview/lib/action_view/template/error.rb
File renamed without changes
View
0  actionpack/lib/action_view/template/handlers.rb → actionview/lib/action_view/template/handlers.rb
File renamed without changes
View
2  ...pack/lib/action_view/template/handlers/builder.rb → ...view/lib/action_view/template/handlers/builder.rb
@@ -3,7 +3,7 @@ module Template::Handlers
class Builder
# Default format used by Builder.
class_attribute :default_format
- self.default_format = Mime::XML
+ self.default_format = :xml
def call(template)
require_engine
View
0  actionpack/lib/action_view/template/handlers/erb.rb → actionview/lib/action_view/template/handlers/erb.rb
File renamed without changes
View
0  actionpack/lib/action_view/template/handlers/raw.rb → actionview/lib/action_view/template/handlers/raw.rb
File renamed without changes
View
2  actionpack/lib/action_view/template/resolver.rb → actionview/lib/action_view/template/resolver.rb
@@ -174,7 +174,7 @@ def extract_handler_and_format(path, default_formats)
extension = pieces.pop
ActiveSupport::Deprecation.warn "The file #{path} did not specify a template handler. The default is currently ERB, but will change to RAW in the future." unless extension
handler = Template.handler_for_extension(extension)
- format = pieces.last && Mime[pieces.last]
+ format = pieces.last && pieces.last.to_sym
[handler, format]
end
end
View
9 actionpack/lib/action_view/template/text.rb → actionview/lib/action_view/template/text.rb
@@ -2,12 +2,11 @@ module ActionView #:nodoc:
# = Action View Text Template
class Template
class Text < String #:nodoc:
- attr_accessor :mime_type
+ attr_accessor :type
- def initialize(string, mime_type = nil)
+ def initialize(string, type = nil)
super(string.to_s)
- @mime_type = Mime[mime_type] || mime_type if mime_type
- @mime_type ||= Mime::TEXT
+ @type = type || :text
end
def identifier
@@ -23,7 +22,7 @@ def render(*args)
end
def formats
- [@mime_type.to_sym]
+ [@type.to_sym]
end
end
end
View
0  actionpack/lib/action_view/testing/resolvers.rb → actionview/lib/action_view/testing/resolvers.rb
File renamed without changes
View
20 actionview/lib/action_view/vendor/html-scanner.rb
@@ -0,0 +1,20 @@
+$LOAD_PATH << "#{File.dirname(__FILE__)}/html-scanner"
+
+module HTML
+ extend ActiveSupport::Autoload
+
+ eager_autoload do
+ autoload :CDATA, 'html/node'
+ autoload :Document, 'html/document'
+ autoload :FullSanitizer, 'html/sanitizer'
+ autoload :LinkSanitizer, 'html/sanitizer'
+ autoload :Node, 'html/node'
+ autoload :Sanitizer, 'html/sanitizer'
+ autoload :Selector, 'html/selector'
+ autoload :Tag, 'html/node'
+ autoload :Text, 'html/node'
+ autoload :Tokenizer, 'html/tokenizer'
+ autoload :Version, 'html/version'
+ autoload :WhiteListSanitizer, 'html/sanitizer'
+ end
+end
View
0  ...n_controller/vendor/html-scanner/html/document.rb → .../action_view/vendor/html-scanner/html/document.rb
File renamed without changes
View
0  ...ction_controller/vendor/html-scanner/html/node.rb → .../lib/action_view/vendor/html-scanner/html/node.rb
File renamed without changes
View
0  ..._controller/vendor/html-scanner/html/sanitizer.rb → ...action_view/vendor/html-scanner/html/sanitizer.rb
File renamed without changes
View
0  ...n_controller/vendor/html-scanner/html/selector.rb → .../action_view/vendor/html-scanner/html/selector.rb
File renamed without changes
View
0  ..._controller/vendor/html-scanner/html/tokenizer.rb → ...action_view/vendor/html-scanner/html/tokenizer.rb
File renamed without changes
View
0  ...on_controller/vendor/html-scanner/html/version.rb → ...b/action_view/vendor/html-scanner/html/version.rb
File renamed without changes
View
10 actionview/lib/action_view/version.rb
@@ -0,0 +1,10 @@
+module ActionView
+ module VERSION #:nodoc:
+ MAJOR = 4
+ MINOR = 0
+ TINY = 0
+ PRE = "beta"
+
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
+ end
+end
View
361 actionview/test/abstract_unit.rb
@@ -0,0 +1,361 @@
+require File.expand_path('../../../load_paths', __FILE__)
+
+$:.unshift(File.dirname(__FILE__) + '/lib')
+$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
+$:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
+
+ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
+
+require 'active_support/core_ext/kernel/reporting'
+
+# These are the normal settings that will be set up by Railties
+# TODO: Have these tests support other combinations of these values
+silence_warnings do
+ Encoding.default_internal = "UTF-8"
+ Encoding.default_external = "UTF-8"
+end
+
+require 'minitest/autorun'
+require 'abstract_controller'
+require 'action_controller'
+require 'action_view'
+require 'action_view/testing/resolvers'
+require 'action_dispatch'
+require 'active_support/dependencies'
+require 'active_model'
+require 'active_record'
+require 'action_controller/caching'
+require 'action_controller/caching/sweeping'
+
+require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
+
+module Rails
+ class << self
+ def env
+ @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "test")
+ end
+ end
+end
+
+ActiveSupport::Dependencies.hook!
+
+# Show backtraces for deprecated behavior for quicker cleanup.
+ActiveSupport::Deprecation.debug = true
+
+# Register danish language for testing
+I18n.backend.store_translations 'da', {}
+I18n.backend.store_translations 'pt-BR', {}
+ORIGINAL_LOCALES = I18n.available_locales.map {|locale| locale.to_s }.sort
+
+FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
+FIXTURES = Pathname.new(FIXTURE_LOAD_PATH)
+
+module RackTestUtils
+ def body_to_string(body)
+ if body.respond_to?(:each)
+ str = ""
+ body.each {|s| str << s }
+ str
+ else
+ body
+ end
+ end
+ extend self
+end
+
+module RenderERBUtils
+ def view
+ @view ||= begin
+ path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)
+ view_paths = ActionView::PathSet.new([path])
+ ActionView::Base.new(view_paths)
+ end
+ end
+
+ def render_erb(string)
+ @virtual_path = nil
+
+ template = ActionView::Template.new(
+ string.strip,
+ "test template",
+ ActionView::Template::Handlers::ERB,
+ {})
+
+ template.render(self, {}).strip
+ end
+end
+
+module SetupOnce
+ extend ActiveSupport::Concern
+
+ included do
+ cattr_accessor :setup_once_block
+ self.setup_once_block = nil
+
+ setup :run_setup_once
+ end
+
+ module ClassMethods
+ def setup_once(&block)
+ self.setup_once_block = block
+ end
+ end
+
+ private
+ def run_setup_once
+ if self.setup_once_block
+ self.setup_once_block.call
+ self.setup_once_block = nil
+ end
+ end
+end
+
+SharedTestRoutes = ActionDispatch::Routing::RouteSet.new
+
+module ActiveSupport
+ class TestCase
+ include SetupOnce
+ # Hold off drawing routes until all the possible controller classes
+ # have been loaded.
+ setup_once do
+ SharedTestRoutes.draw do
+ get ':controller(/:action)'
+ end
+
+ ActionDispatch::IntegrationTest.app.routes.draw do
+ get ':controller(/:action)'
+ end
+ end
+ end
+end
+
+class RoutedRackApp
+ attr_reader :routes
+
+ def initialize(routes, &blk)
+ @routes = routes
+ @stack = ActionDispatch::MiddlewareStack.new(&blk).build(@routes)
+ end
+
+ def call(env)
+ @stack.call(env)
+ end
+end
+
+class BasicController
+ attr_accessor :request
+
+ def config
+ @config ||= ActiveSupport::InheritableOptions.new(ActionController::Base.config).tap do |config|
+ # VIEW TODO: View tests should not require a controller
+ public_dir = File.expand_path("../fixtures/public", __FILE__)
+ config.assets_dir = public_dir
+ config.javascripts_dir = "#{public_dir}/javascripts"
+ config.stylesheets_dir = "#{public_dir}/stylesheets"
+ config.assets = ActiveSupport::InheritableOptions.new({ :prefix => "assets" })
+ config
+ end
+ end
+end
+
+class ActionDispatch::IntegrationTest < ActiveSupport::TestCase
+ setup do
+ @routes = SharedTestRoutes
+ end
+
+ def self.build_app(routes = nil)
+ RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware|
+ middleware.use "ActionDispatch::ShowExceptions", ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")
+ middleware.use "ActionDispatch::DebugExceptions"
+ middleware.use "ActionDispatch::Callbacks"
+ middleware.use "ActionDispatch::ParamsParser"
+ middleware.use "ActionDispatch::Cookies"
+ middleware.use "ActionDispatch::Flash"
+ middleware.use "ActionDispatch::Head"
+ yield(middleware) if block_given?
+ end
+ end
+
+ self.app = build_app
+
+ # Stub Rails dispatcher so it does not get controller references and
+ # simply return the controller#action as Rack::Body.
+ class StubDispatcher < ::ActionDispatch::Routing::RouteSet::Dispatcher
+ protected
+ def controller_reference(controller_param)
+ controller_param
+ end
+
+ def dispatch(controller, action, env)
+ [200, {'Content-Type' => 'text/html'}, ["#{controller}##{action}"]]
+ end
+ end
+
+ def self.stub_controllers
+ old_dispatcher = ActionDispatch::Routing::RouteSet::Dispatcher
+ ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
+ ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, StubDispatcher }
+ yield ActionDispatch::Routing::RouteSet.new
+ ensure
+ ActionDispatch::Routing::RouteSet.module_eval { remove_const :Dispatcher }
+ ActionDispatch::Routing::RouteSet.module_eval { const_set :Dispatcher, old_dispatcher }
+ end
+
+ def with_routing(&block)
+ temporary_routes = ActionDispatch::Routing::RouteSet.new
+ old_app, self.class.app = self.class.app, self.class.build_app(temporary_routes)
+ old_routes = SharedTestRoutes
+ silence_warnings { Object.const_set(:SharedTestRoutes, temporary_routes) }
+
+ yield temporary_routes
+ ensure
+ self.class.app = old_app
+ silence_warnings { Object.const_set(:SharedTestRoutes, old_routes) }
+ end
+
+ def with_autoload_path(path)
+ path = File.join(File.dirname(__FILE__), "fixtures", path)
+ if ActiveSupport::Dependencies.autoload_paths.include?(path)
+ yield
+ else
+ begin
+ ActiveSupport::Dependencies.autoload_paths << path
+ yield
+ ensure
+ ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path}
+ ActiveSupport::Dependencies.clear
+ end
+ end
+ end
+end
+
+# Temporary base class
+class Rack::TestCase < ActionDispatch::IntegrationTest
+ def self.testing(klass = nil)
+ if klass
+ @testing = "/#{klass.name.underscore}".sub!(/_controller$/, '')
+ else
+ @testing
+ end
+ end
+
+ def get(thing, *args)
+ if thing.is_a?(Symbol)
+ super("#{self.class.testing}/#{thing}", *args)
+ else
+ super
+ end
+ end
+
+ def assert_body(body)
+ assert_equal body, Array(response.body).join
+ end
+
+ def assert_status(code)
+ assert_equal code, response.status
+ end
+
+ def assert_response(body, status = 200, headers = {})
+ assert_body body
+ assert_status status
+ headers.each do |header, value|
+ assert_header header, value
+ end
+ end
+
+ def assert_content_type(type)
+ assert_equal type, response.headers["Content-Type"]
+ end
+
+ def assert_header(name, value)
+ assert_equal value, response.headers[name]
+ end
+end
+
+module ActionController
+ class Base
+ include ActionController::Testing
+ # This stub emulates the Railtie including the URL helpers from a Rails application
+ include SharedTestRoutes.url_helpers
+ include SharedTestRoutes.mounted_helpers
+
+ self.view_paths = FIXTURE_LOAD_PATH
+
+ def self.test_routes(&block)
+ routes = ActionDispatch::Routing::RouteSet.new
+ routes.draw(&block)
+ include routes.url_helpers
+ end
+ end
+
+ class TestCase
+ include ActionDispatch::TestProcess
+
+ setup do
+ @routes = SharedTestRoutes
+ end
+ end
+end
+
+class ::ApplicationController < ActionController::Base
+end
+
+module ActionView
+ class TestCase
+ # Must repeat the setup because AV::TestCase is a duplication
+ # of AC::TestCase
+ setup do
+ @routes = SharedTestRoutes
+ end
+ end
+end
+
+class Workshop
+ extend ActiveModel::Naming
+ include ActiveModel::Conversion
+ attr_accessor :id
+
+ def initialize(id)
+ @id = id
+ end
+
+ def persisted?