Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/rails/rails

  • Loading branch information...
commit 9887f238871bb2dd73de6ce8855615bcc5d8d079 2 parents aff8215 + 5214e73
@goncalossilva goncalossilva authored
Showing with 10,432 additions and 7,081 deletions.
  1. +3 −0  .gitignore
  2. +4 −0 .yardopts
  3. +37 −15 Gemfile
  4. +1 −1  RAILS_VERSION
  5. +17 −16 README.rdoc
  6. +37 −58 Rakefile
  7. +14 −16 actionmailer/CHANGELOG
  8. +1 −1  actionmailer/MIT-LICENSE
  9. +18 −17 actionmailer/README.rdoc
  10. +2 −18 actionmailer/Rakefile
  11. +1 −1  actionmailer/actionmailer.gemspec
  12. +2 −2 actionmailer/lib/action_mailer.rb
  13. +19 −17 actionmailer/lib/action_mailer/adv_attr_accessor.rb
  14. +33 −59 actionmailer/lib/action_mailer/base.rb
  15. +2 −2 actionmailer/lib/action_mailer/delivery_methods.rb
  16. +0 −141 actionmailer/lib/action_mailer/deprecated_api.rb
  17. +27 −12 actionmailer/lib/action_mailer/mail_helper.rb
  18. +34 −38 actionmailer/lib/action_mailer/old_api.rb
  19. +18 −5 actionmailer/lib/action_mailer/railtie.rb
  20. +5 −2 actionmailer/lib/action_mailer/test_case.rb
  21. +15 −12 actionmailer/lib/action_mailer/tmail_compat.rb
  22. +3 −3 actionmailer/lib/action_mailer/version.rb
  23. +4 −1 actionmailer/lib/rails/generators/mailer/USAGE
  24. +3 −1 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
  25. +14 −3 actionmailer/test/abstract_unit.rb
  26. +5 −5 actionmailer/test/{old_base → }/asset_host_test.rb
  27. +19 −16 actionmailer/test/base_test.rb
  28. +3 −3 actionmailer/test/delivery_methods_test.rb
  29. +1 −0  actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb
  30. +4 −0 actionmailer/test/fixtures/i18n_test_mailer/mail_with_i18n_subject.erb
  31. +1 −1  actionmailer/test/fixtures/raw_email10
  32. +1 −1  actionmailer/test/fixtures/raw_email2
  33. +1 −1  actionmailer/test/fixtures/raw_email3
  34. +1 −1  actionmailer/test/fixtures/raw_email5
  35. +1 −1  actionmailer/test/fixtures/raw_email6
  36. +1 −1  actionmailer/test/fixtures/raw_email8
  37. +5 −5 actionmailer/test/fixtures/raw_email9
  38. +1 −1  actionmailer/test/fixtures/templates/signed_up.erb
  39. +2 −2 actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml
  40. +2 −2 actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml
  41. +1 −1  actionmailer/test/fixtures/test_mailer/signed_up.html.erb
  42. +1 −1  actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb
  43. +46 −0 actionmailer/test/i18n_with_controller_test.rb
  44. +13 −0 actionmailer/test/mail_helper_test.rb
  45. +16 −37 actionmailer/test/{old_base → }/mail_layout_test.rb
  46. +4 −0 actionmailer/test/mailers/base_mailer.rb
  47. +3 −3 actionmailer/test/mailers/proc_mailer.rb
  48. +5 −0 actionmailer/test/old_base/adv_attr_test.rb
  49. +5 −38 actionmailer/test/old_base/mail_render_test.rb
  50. +19 −128 actionmailer/test/old_base/mail_service_test.rb
  51. +8 −1 actionmailer/test/old_base/tmail_compat_test.rb
  52. +15 −16 actionmailer/test/test_helper_test.rb
  53. +9 −12 actionmailer/test/{old_base → }/url_test.rb
  54. +73 −15 actionpack/CHANGELOG
  55. +1 −1  actionpack/MIT-LICENSE
  56. +4 −4 actionpack/README.rdoc
  57. +9 −6 actionpack/RUNNING_UNIT_TESTS
  58. +3 −23 actionpack/Rakefile
  59. +10 −9 actionpack/actionpack.gemspec
  60. +2 −0  actionpack/lib/abstract_controller.rb
  61. +24 −22 actionpack/lib/abstract_controller/base.rb
  62. +11 −10 actionpack/lib/abstract_controller/callbacks.rb
  63. +24 −7 actionpack/lib/abstract_controller/helpers.rb
  64. +18 −20 actionpack/lib/abstract_controller/layouts.rb
  65. +18 −0 actionpack/lib/abstract_controller/railties/routes_helpers.rb
  66. +37 −19 actionpack/lib/abstract_controller/rendering.rb
  67. +27 −0 actionpack/lib/abstract_controller/url_for.rb
  68. +8 −8 actionpack/lib/abstract_controller/view_paths.rb
  69. +1 −1  actionpack/lib/action_controller.rb
  70. +165 −7 actionpack/lib/action_controller/base.rb
  71. +2 −2 actionpack/lib/action_controller/caching.rb
  72. +55 −39 actionpack/lib/action_controller/caching/actions.rb
  73. +41 −19 actionpack/lib/action_controller/caching/fragments.rb
  74. +15 −14 actionpack/lib/action_controller/caching/pages.rb
  75. +1 −1  actionpack/lib/action_controller/deprecated.rb
  76. +0 −133 actionpack/lib/action_controller/deprecated/base.rb
  77. +0 −28 actionpack/lib/action_controller/deprecated/dispatcher.rb
  78. +6 −2 actionpack/lib/action_controller/log_subscriber.rb
  79. +80 −21 actionpack/lib/action_controller/metal.rb
  80. +0 −9 actionpack/lib/action_controller/metal/compatibility.rb
  81. +9 −9 actionpack/lib/action_controller/metal/conditional_get.rb
  82. +3 −5 actionpack/lib/action_controller/metal/head.rb
  83. +21 −28 actionpack/lib/action_controller/metal/helpers.rb
  84. +2 −3 actionpack/lib/action_controller/metal/hide_actions.rb
  85. +35 −34 actionpack/lib/action_controller/metal/http_authentication.rb
  86. +2 −2 actionpack/lib/action_controller/metal/implicit_render.rb
  87. +1 −1  actionpack/lib/action_controller/metal/instrumentation.rb
  88. +11 −11 actionpack/lib/action_controller/metal/mime_responds.rb
  89. +8 −2 actionpack/lib/action_controller/metal/redirecting.rb
  90. +48 −27 actionpack/lib/action_controller/metal/renderers.rb
  91. +24 −26 actionpack/lib/action_controller/metal/rendering.rb
  92. +35 −50 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  93. +29 −17 actionpack/lib/action_controller/metal/responder.rb
  94. +0 −12 actionpack/lib/action_controller/metal/streaming.rb
  95. +0 −9 actionpack/lib/action_controller/metal/testing.rb
  96. +12 −14 actionpack/lib/action_controller/metal/url_for.rb
  97. +1 −1  actionpack/lib/action_controller/middleware.rb
  98. +18 −37 actionpack/lib/action_controller/railtie.rb
  99. +32 −0 actionpack/lib/action_controller/railties/paths.rb
  100. +45 −20 actionpack/lib/action_controller/test_case.rb
  101. +2 −2 actionpack/lib/action_controller/vendor/html-scanner/html/document.rb
  102. +38 −44 actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
  103. +28 −28 actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
  104. +1 −1  actionpack/lib/action_controller/vendor/html-scanner/html/selector.rb
  105. +8 −8 actionpack/lib/action_controller/vendor/html-scanner/html/tokenizer.rb
  106. +3 −1 actionpack/lib/action_dispatch.rb
  107. +7 −34 actionpack/lib/action_dispatch/http/cache.rb
  108. +17 −4 actionpack/lib/action_dispatch/http/filter_parameters.rb
  109. +5 −3 actionpack/lib/action_dispatch/http/mime_negotiation.rb
  110. +59 −15 actionpack/lib/action_dispatch/http/mime_type.rb
  111. +2 −2 actionpack/lib/action_dispatch/http/parameters.rb
  112. +58 −0 actionpack/lib/action_dispatch/http/rack_cache.rb
  113. +55 −22 actionpack/lib/action_dispatch/http/request.rb
  114. +12 −14 actionpack/lib/action_dispatch/http/response.rb
  115. +29 −31 actionpack/lib/action_dispatch/http/upload.rb
  116. +106 −36 actionpack/lib/action_dispatch/http/url.rb
  117. +8 −25 actionpack/lib/action_dispatch/middleware/callbacks.rb
  118. +55 −15 actionpack/lib/action_dispatch/middleware/cookies.rb
  119. +7 −2 actionpack/lib/action_dispatch/middleware/flash.rb
  120. +76 −0 actionpack/lib/action_dispatch/middleware/reloader.rb
  121. +54 −226 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
  122. +20 −44 actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
  123. +7 −46 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
  124. +27 −21 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  125. +50 −17 actionpack/lib/action_dispatch/middleware/stack.rb
  126. +46 −18 actionpack/lib/action_dispatch/middleware/static.rb
  127. +2 −2 actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
  128. +3 −3 actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb
  129. +2 −2 actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
  130. +2 −6 actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.erb
  131. +4 −3 actionpack/lib/action_dispatch/railtie.rb
  132. +91 −26 actionpack/lib/action_dispatch/routing.rb
  133. +0 −525 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
  134. +800 −277 actionpack/lib/action_dispatch/routing/mapper.rb
  135. +42 −22 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
  136. +110 −0 actionpack/lib/action_dispatch/routing/redirection.rb
  137. +15 −12 actionpack/lib/action_dispatch/routing/route.rb
  138. +118 −88 actionpack/lib/action_dispatch/routing/route_set.rb
  139. +35 −0 actionpack/lib/action_dispatch/routing/routes_proxy.rb
  140. +28 −5 actionpack/lib/action_dispatch/routing/url_for.rb
  141. +1 −1  actionpack/lib/action_dispatch/testing/assertions/dom.rb
  142. +8 −12 actionpack/lib/action_dispatch/testing/assertions/response.rb
  143. +53 −32 actionpack/lib/action_dispatch/testing/assertions/routing.rb
  144. +5 −22 actionpack/lib/action_dispatch/testing/assertions/selector.rb
  145. +32 −21 actionpack/lib/action_dispatch/testing/integration.rb
  146. +1 −3 actionpack/lib/action_dispatch/testing/performance_test.rb
  147. +1 −1  actionpack/lib/action_dispatch/testing/test_process.rb
  148. +9 −3 actionpack/lib/action_dispatch/testing/test_request.rb
  149. +4 −111 actionpack/lib/action_dispatch/testing/test_response.rb
  150. +1 −1  actionpack/lib/action_pack.rb
  151. +3 −3 actionpack/lib/action_pack/version.rb
  152. +29 −24 actionpack/lib/action_view.rb
  153. +35 −32 actionpack/lib/action_view/base.rb
  154. +2 −3 actionpack/lib/action_view/helpers.rb
  155. +0 −23 actionpack/lib/action_view/helpers/active_model_helper.rb
  156. +14 −480 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  157. +146 −0 actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
  158. +153 −0 actionpack/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb
  159. +184 −0 actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb
  160. +147 −0 actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
  161. +1 −1  actionpack/lib/action_view/helpers/atom_feed_helper.rb
  162. +12 −14 actionpack/lib/action_view/helpers/cache_helper.rb
  163. +3 −2 actionpack/lib/action_view/helpers/capture_helper.rb
  164. +22 −6 actionpack/lib/action_view/helpers/csrf_helper.rb
  165. +40 −30 actionpack/lib/action_view/helpers/date_helper.rb
  166. +1 −1  actionpack/lib/action_view/helpers/debug_helper.rb
  167. +190 −117 actionpack/lib/action_view/helpers/form_helper.rb
  168. +31 −29 actionpack/lib/action_view/helpers/form_options_helper.rb
  169. +90 −24 actionpack/lib/action_view/helpers/form_tag_helper.rb
  170. +2 −1  actionpack/lib/action_view/helpers/javascript_helper.rb
  171. +53 −41 actionpack/lib/action_view/helpers/number_helper.rb
  172. +38 −0 actionpack/lib/action_view/helpers/output_safety_helper.rb
  173. +13 −13 actionpack/lib/action_view/helpers/prototype_helper.rb
  174. +0 −18 actionpack/lib/action_view/helpers/raw_output_helper.rb
  175. +3 −3 actionpack/lib/action_view/helpers/record_tag_helper.rb
  176. +2 −2 actionpack/lib/action_view/helpers/sanitize_helper.rb
  177. +34 −12 actionpack/lib/action_view/helpers/tag_helper.rb
  178. +42 −20 actionpack/lib/action_view/helpers/text_helper.rb
  179. +34 −16 actionpack/lib/action_view/helpers/translation_helper.rb
  180. +70 −66 actionpack/lib/action_view/helpers/url_helper.rb
  181. +1 −1  actionpack/lib/action_view/locale/en.yml
  182. +1 −1  actionpack/lib/action_view/log_subscriber.rb
  183. +37 −18 actionpack/lib/action_view/lookup_context.rb
  184. +52 −164 actionpack/lib/action_view/{render → }/partials.rb
  185. +8 −8 actionpack/lib/action_view/{paths.rb → path_set.rb}
  186. +11 −3 actionpack/lib/action_view/railtie.rb
  187. +0 −79 actionpack/lib/action_view/render/layouts.rb
  188. +0 −67 actionpack/lib/action_view/render/rendering.rb
  189. +37 −0 actionpack/lib/action_view/renderer/abstract_renderer.rb
  190. +167 −0 actionpack/lib/action_view/renderer/partial_renderer.rb
  191. +98 −0 actionpack/lib/action_view/renderer/template_renderer.rb
  192. +106 −0 actionpack/lib/action_view/rendering.rb
  193. +110 −45 actionpack/lib/action_view/template.rb
  194. +11 −8 actionpack/lib/action_view/template/error.rb
  195. +10 −2 actionpack/lib/action_view/template/handler.rb
  196. +11 −9 actionpack/lib/action_view/template/handlers.rb
  197. +4 −4 actionpack/lib/action_view/template/handlers/builder.rb
  198. +19 −24 actionpack/lib/action_view/template/handlers/erb.rb
  199. +4 −8 actionpack/lib/action_view/template/handlers/rjs.rb
  200. +180 −41 actionpack/lib/action_view/template/resolver.rb
  201. +0 −4 actionpack/lib/action_view/template/text.rb
  202. +43 −24 actionpack/lib/action_view/test_case.rb
  203. +19 −12 actionpack/lib/action_view/testing/resolvers.rb
  204. +7 −7 actionpack/test/abstract/abstract_controller_test.rb
  205. +82 −59 actionpack/test/abstract/callbacks_test.rb
  206. +22 −5 actionpack/test/abstract/helper_test.rb
  207. +1 −1  actionpack/test/abstract/layouts_test.rb
  208. +2 −2 actionpack/test/abstract/render_test.rb
  209. +4 −4 actionpack/test/abstract/translation_test.rb
  210. +67 −46 actionpack/test/abstract_unit.rb
  211. +58 −0 actionpack/test/action_dispatch/routing/mapper_test.rb
  212. +34 −2 actionpack/test/activerecord/active_record_store_test.rb
  213. +2 −2 actionpack/test/activerecord/controller_runtime_test.rb
  214. +73 −9 actionpack/test/activerecord/polymorphic_routes_test.rb
  215. +3 −35 actionpack/test/activerecord/render_partial_with_record_identification_test.rb
  216. +75 −141 actionpack/test/controller/action_pack_assertions_test.rb
  217. +12 −14 actionpack/test/controller/assert_select_test.rb
  218. +6 −20 actionpack/test/controller/base_test.rb
  219. +43 −12 actionpack/test/controller/caching_test.rb
  220. +9 −1 actionpack/test/controller/capture_test.rb
  221. +12 −12 actionpack/test/controller/content_type_test.rb
  222. +0 −59 actionpack/test/controller/dispatcher_test.rb
  223. +114 −8 actionpack/test/controller/filters_test.rb
  224. +2 −2 actionpack/test/controller/flash_test.rb
  225. +50 −18 actionpack/test/controller/helper_test.rb
  226. +3 −3 actionpack/test/controller/http_basic_authentication_test.rb
  227. +3 −3 actionpack/test/controller/http_token_authentication_test.rb
  228. +7 −7 actionpack/test/controller/integration_test.rb
  229. +12 −12 actionpack/test/controller/layout_test.rb
  230. +42 −24 actionpack/test/controller/log_subscriber_test.rb
  231. +118 −11 actionpack/test/controller/mime_responds_test.rb
  232. +22 −0 actionpack/test/controller/new_base/bare_metal_test.rb
  233. +9 −0 actionpack/test/controller/new_base/content_negotiation_test.rb
  234. +9 −3 actionpack/test/controller/new_base/content_type_test.rb
  235. +0 −46 actionpack/test/controller/new_base/etag_test.rb
  236. +22 −0 actionpack/test/controller/new_base/middleware_test.rb
  237. +3 −0  actionpack/test/controller/new_base/render_action_test.rb
  238. +2 −2 actionpack/test/controller/new_base/render_implicit_action_test.rb
  239. +1 −1  actionpack/test/controller/new_base/render_layout_test.rb
  240. +86 −0 actionpack/test/controller/new_base/render_once_test.rb
  241. +44 −8 actionpack/test/controller/new_base/render_partial_test.rb
  242. +46 −8 actionpack/test/controller/new_base/render_template_test.rb
  243. +59 −7 actionpack/test/controller/new_base/render_test.rb
  244. +26 −18 actionpack/test/controller/new_base/render_text_test.rb
  245. +1 −1  actionpack/test/controller/new_base/render_xml_test.rb
  246. +1 −1  actionpack/test/controller/output_escaping_test.rb
  247. +1 −26 actionpack/test/controller/record_identifier_test.rb
  248. +39 −19 actionpack/test/controller/redirect_test.rb
  249. +23 −0 actionpack/test/controller/render_json_test.rb
  250. +4 −3 actionpack/test/controller/render_other_test.rb
  251. +37 −127 actionpack/test/controller/render_test.rb
  252. +2 −3 actionpack/test/controller/render_xml_test.rb
  253. +1 −2  actionpack/test/controller/request/test_request_test.rb
  254. +100 −122 actionpack/test/controller/request_forgery_protection_test.rb
  255. +3 −17 actionpack/test/controller/rescue_test.rb
  256. +292 −334 actionpack/test/controller/resources_test.rb
  257. +681 −779 actionpack/test/controller/routing_test.rb
  258. +22 −0 actionpack/test/controller/runner_test.rb
  259. +5 −5 actionpack/test/controller/selector_test.rb
  260. +29 −15 actionpack/test/controller/test_test.rb
  261. +50 −8 actionpack/test/controller/url_for_test.rb
  262. +5 −0 actionpack/test/controller/url_rewriter_test.rb
  263. +2 −2 actionpack/test/controller/view_paths_test.rb
  264. +6 −5 actionpack/test/controller/webservice_test.rb
  265. +16 −60 actionpack/test/dispatch/callbacks_test.rb
  266. +251 −4 actionpack/test/dispatch/cookies_test.rb
  267. +77 −0 actionpack/test/dispatch/middleware_stack/middleware_test.rb
  268. +16 −1 actionpack/test/dispatch/middleware_stack_test.rb
  269. +56 −3 actionpack/test/dispatch/mime_type_test.rb
  270. +19 −1 actionpack/test/dispatch/mount_test.rb
  271. +317 −0 actionpack/test/dispatch/prefix_generation_test.rb
  272. +138 −0 actionpack/test/dispatch/reloader_test.rb
  273. +2 −2 actionpack/test/dispatch/request/json_params_parsing_test.rb
  274. +3 −10 actionpack/test/dispatch/request/multipart_params_parsing_test.rb
  275. +2 −2 actionpack/test/dispatch/request/query_string_parsing_test.rb
  276. +2 −2 actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
  277. +3 −2 actionpack/test/dispatch/request/xml_params_parsing_test.rb
  278. +134 −6 actionpack/test/dispatch/request_test.rb
  279. +19 −20 actionpack/test/dispatch/response_test.rb
  280. +103 −0 actionpack/test/dispatch/routing_assertions_test.rb
  281. +595 −21 actionpack/test/dispatch/routing_test.rb
  282. +24 −20 actionpack/test/dispatch/session/cookie_store_test.rb
  283. +3 −3 actionpack/test/dispatch/session/mem_cache_store_test.rb
  284. +27 −21 actionpack/test/dispatch/show_exceptions_test.rb
  285. +66 −20 actionpack/test/dispatch/static_test.rb
  286. +2 −2 actionpack/test/dispatch/test_request_test.rb
  287. +21 −0 actionpack/test/dispatch/test_response_test.rb
  288. +70 −0 actionpack/test/dispatch/uploaded_file_test.rb
  289. +2 −1  actionpack/test/dispatch/url_generation_test.rb
  290. +1 −1  actionpack/test/fixtures/alternate_helpers/foo_helper.rb
  291. +1 −0  actionpack/test/fixtures/blog_public/.gitignore
  292. +1 −0  actionpack/test/fixtures/blog_public/blog.html
  293. +1 −0  actionpack/test/fixtures/blog_public/index.html
  294. +1 −0  actionpack/test/fixtures/blog_public/subdir/index.html
  295. +1 −1  actionpack/test/fixtures/companies.yml
  296. +1 −1  actionpack/test/fixtures/company.rb
  297. +1 −0  actionpack/test/fixtures/custom_pattern/another.html.erb
  298. +1 −0  actionpack/test/fixtures/custom_pattern/html/another.erb
  299. +1 −0  actionpack/test/fixtures/custom_pattern/html/path.erb
  300. +10 −10 actionpack/test/fixtures/db_definitions/sqlite.sql
Sorry, we could not display the entire diff because too many files (1,255) changed.
View
3  .gitignore
@@ -10,12 +10,15 @@ activerecord/doc
actionpack/doc
actionmailer/doc
activesupport/doc
+activesupport/test/tmp
activemodel/test/fixtures/fixture_database.sqlite3
actionpack/test/tmp
activesupport/test/fixtures/isolation_test
+dist
railties/test/500.html
railties/test/fixtures/tmp
railties/test/initializer/root/log
railties/doc
railties/guides/output
railties/tmp
+.rvmrc
View
4 .yardopts
@@ -0,0 +1,4 @@
+--exclude /templates/
+--quiet
+act*/lib/**/*.rb
+railties/lib/**/*.rb
View
52 Gemfile
@@ -1,41 +1,55 @@
source 'http://rubygems.org'
+gemspec
+
if ENV['AREL']
gem "arel", :path => ENV['AREL']
else
gem "arel", :git => "git://github.com/rails/arel.git"
end
-gem "rails", :path => File.dirname(__FILE__)
+gem "rack", :git => "git://github.com/rack/rack.git"
+gem "rack-test", :git => "git://github.com/brynary/rack-test.git"
gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
-gem "rdoc", ">= 2.5.9"
-gem "horo", ">= 1.0.1"
+
+group :doc do
+ gem "rdoc", "~> 3.4"
+ gem "horo", "= 1.0.3"
+ gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
+end
# AS
gem "memcache-client", ">= 1.8.5"
-
-# AM
-gem "text-format", "~> 1.0.0"
+gem "fssm", "~> 0.2.5"
platforms :mri_18 do
gem "system_timer"
gem "ruby-debug", ">= 0.10.3"
+ gem 'ruby-prof'
+end
+
+platforms :mri_19 do
+ # TODO: Remove the conditional when ruby-debug19 supports Ruby >= 1.9.3
+ gem "ruby-debug19", :require => 'ruby-debug' if RUBY_VERSION < "1.9.3"
end
platforms :ruby do
+ if ENV["RB_FSEVENT"]
+ gem 'rb-fsevent'
+ end
gem 'json'
gem 'yajl-ruby'
- gem "nokogiri", ">= 1.4.3.1"
+ gem "nokogiri", ">= 1.4.4"
# AR
- gem "sqlite3-ruby", "~> 1.3.1", :require => 'sqlite3'
+ gem "sqlite3", "~> 1.3.3"
group :db do
gem "pg", ">= 0.9.0"
gem "mysql", ">= 2.8.1"
- gem "mysql2", :git => 'git://github.com/brianmario/mysql2.git'
+ gem "mysql2", :git => "git://github.com/brianmario/mysql2.git"
end
end
@@ -44,17 +58,25 @@ platforms :jruby do
gem "activerecord-jdbcsqlite3-adapter"
+ # This is needed by now to let tests work on JRuby
+ # TODO: When the JRuby guys merge jruby-openssl in
+ # jruby this will be removed
+ gem "jruby-openssl"
+
group :db do
gem "activerecord-jdbcmysql-adapter"
gem "activerecord-jdbcpostgresql-adapter"
end
end
-env 'CI' do
- gem "nokogiri", ">= 1.4.3.1"
-
- platforms :ruby_18 do
- # fcgi gem doesn't compile on 1.9
- gem "fcgi", ">= 0.8.8"
+# gems that are necessary for ActiveRecord tests with Oracle database
+if ENV['ORACLE_ENHANCED_PATH'] || ENV['ORACLE_ENHANCED']
+ platforms :ruby do
+ gem 'ruby-oci8', ">= 2.0.4"
+ end
+ if ENV['ORACLE_ENHANCED_PATH']
+ gem 'activerecord-oracle_enhanced-adapter', :path => ENV['ORACLE_ENHANCED_PATH']
+ else
+ gem "activerecord-oracle_enhanced-adapter", :git => "git://github.com/rsim/oracle-enhanced.git"
end
end
View
2  RAILS_VERSION
@@ -1 +1 @@
-3.0.0.rc
+3.1.0.beta
View
33 README.rdoc
@@ -1,6 +1,6 @@
-== Welcome to Rails
+== Welcome to \Rails
-Rails is a web-application framework that includes everything needed to create
+\Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.
This pattern splits the view (also called the presentation) into "dumb"
@@ -11,30 +11,30 @@ persist themselves to a database. The controller handles the incoming requests
(such as Save New Account, Update Product, Show Post) by manipulating the model
and directing data to the view.
-In Rails, the model is handled by what's called an object-relational mapping
+In \Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
+methods. You can read more about Active Record in its
+{README}[link:files/activerecord/README_rdoc.html].
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
+\Rails. You can read more about Action Pack in its
+{README}[link:files/actionpack/README_rdoc.html].
== Getting Started
-1. Install Rails at the command prompt if you haven't yet:
+1. Install \Rails at the command prompt if you haven't yet:
gem install rails
-2. At the command prompt, create a new Rails application:
+2. At the command prompt, create a new \Rails application:
- rails new myapp
+ rails new myapp
where "myapp" is the application name.
@@ -48,20 +48,21 @@ link:files/vendor/rails/actionpack/README.html.
"Welcome aboard: You're riding Ruby on Rails!"
-5. Follow the guidelines to start developing your application. You can find
-the following resources handy:
+5. Follow the guidelines to start developing your application. You can find the following resources handy:
* The README file created within your application.
-* The {Getting Started Guide}[http://guides.rubyonrails.org/getting_started.html].
-* The {Ruby on Rails Tutorial Book}[http://railstutorial.org/book].
+* The {Getting Started with Rails}[http://guides.rubyonrails.org/getting_started.html].
+* The {Ruby on Rails Tutorial}[http://railstutorial.org/book].
+* The {Ruby on Rails Guides}[http://guides.rubyonrails.org].
+* The {API Documentation}[http://api.rubyonrails.org].
== Contributing
-We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
+We encourage you to contribute to Ruby on \Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how
to proceed. {Join us}[http://contributors.rubyonrails.org]!
== License
-Ruby on Rails is released under the MIT license.
+Ruby on \Rails is released under the MIT license.
View
95 Rakefile 100644 → 100755
@@ -1,34 +1,16 @@
-gem 'rdoc', '>= 2.5.9'
-require 'rdoc'
+#!/usr/bin/env rake
-require 'rake'
require 'rdoc/task'
-require 'rake/gempackagetask'
-
-# RDoc skips some files in the Rails tree due to its binary? predicate. This is a quick
-# hack for edge docs, until we decide which is the correct way to address this issue.
-# If not fixed in RDoc itself, via an option or something, we should probably move this
-# to railties and use it also in doc:rails.
-def hijack_rdoc!
- require "rdoc/parser"
- class << RDoc::Parser
- def binary?(file)
- s = File.read(file, 1024) or return false
-
- if s[0, 2] == Marshal.dump('')[0, 2] then
- true
- elsif file =~ /erb\.rb$/ then
- false
- elsif s.index("\x00") then # ORIGINAL is s.scan(/<%|%>/).length >= 4 || s.index("\x00")
- true
- elsif 0.respond_to? :fdiv then
- s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
- else # HACK 1.8.6
- (s.count("^ -~\t\r\n").to_f / s.size) > 0.3
- end
- end
- end
-end
+require 'net/http'
+
+$:.unshift File.expand_path('..', __FILE__)
+require "tasks/release"
+
+desc "Build gem files for all projects"
+task :build => "all:build"
+
+desc "Release all gems to gemcutter and create a tag"
+task :release => "all:release"
PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
@@ -54,27 +36,6 @@ task :smoke do
system %(cd activerecord && #{$0} sqlite3:isolated_test)
end
-spec = eval(File.read('rails.gemspec'))
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
-end
-
-desc "Release all gems to gemcutter. Package rails, package & push components, then push rails"
-task :release => :release_projects do
- require 'rake/gemcutter'
- Rake::Gemcutter::Tasks.new(spec).define
- Rake::Task['gem:push'].invoke
-end
-
-desc "Release all components to gemcutter."
-task :release_projects => :package do
- errors = []
- PROJECTS.each do |project|
- system(%(cd #{project} && #{$0} release)) || errors << project
- end
- fail("Errors in #{errors.join(', ')}") unless errors.empty?
-end
-
desc "Install gems for all projects."
task :install => :gem do
version = File.read("RAILS_VERSION").strip
@@ -88,8 +49,6 @@ end
desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc|
- hijack_rdoc!
-
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"
@@ -126,6 +85,7 @@ RDoc::Task.new do |rdoc|
rdoc.rdoc_files.include('actionmailer/README.rdoc')
rdoc.rdoc_files.include('actionmailer/CHANGELOG')
rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
+ rdoc.rdoc_files.include('actionmailer/lib/action_mailer/mail_helper.rb')
rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
rdoc.rdoc_files.include('activesupport/README.rdoc')
@@ -144,12 +104,7 @@ task :rdoc do
FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
end
-desc "Publish API docs for Rails as a whole and for each component"
-task :pdoc => :rdoc do
- require 'rake/contrib/sshpublisher'
- Rake::SshDirPublisher.new("rails@api.rubyonrails.org", "public_html/api", "doc/rdoc").upload
-end
-
+desc 'Bump all versions to match version.rb'
task :update_versions do
require File.dirname(__FILE__) + "/version"
@@ -177,3 +132,27 @@ task :update_versions do
end
end
end
+
+#
+# We have a webhook configured in Github that gets invoked after pushes.
+# This hook triggers the following tasks:
+#
+# * updates the local checkout
+# * updates Rails Contributors
+# * generates and publishes edge docs
+# * if there's a new stable tag, generates and publishes stable docs
+#
+# Everything is automated and you do NOT need to run this task normally.
+#
+# We publish a new version by tagging, and pushing a tag does not trigger
+# that webhook. Stable docs would be updated by any subsequent regular
+# push, but if you want that to happen right away just run this.
+#
+desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
+task :publish_docs do
+ Net::HTTP.new('rails-hooks.hashref.com').start do |http|
+ request = Net::HTTP::Post.new('/rails-master-hook')
+ response = http.request(request)
+ puts response.body
+ end
+end
View
30 actionmailer/CHANGELOG
@@ -1,9 +1,16 @@
-*Rails 3.0.0 [release candidate] (July 26th, 2010)*
+*Rails 3.1.0 (unreleased)*
-* No material changes
+* No changes
+*Rails 3.0.2 (unreleased)*
-*Rails 3.0.0 [beta 4] (June 8th, 2010)*
+* No changes
+
+*Rails 3.0.1 (October 15, 2010)*
+
+* No Changes, just a version bump.
+
+*Rails 3.0.0 (August 29, 2010)*
* subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(".subject") [JK]
@@ -11,16 +18,10 @@
* Added ability to pass Proc objects to the defaults hash [ML]
-
-*Rails 3.0.0 [beta 3] (April 13th, 2010)*
-
* Removed all quoting.rb type files from ActionMailer and put Mail 2.2.0 in instead [ML]
* Lot of updates to various test cases that now work better with the new Mail and so have different expectations
-
-*Rails 3.0.0 [beta 2] (April 1st, 2010)*
-
* Added interceptors and observers from Mail [ML]
ActionMailer::Base.register_interceptor calls Mail.register_interceptor
@@ -38,9 +39,6 @@
* Whole new API added with tests. See base.rb for full details. Old API is deprecated.
-
-*Rails 3.0.0 [beta 1] (February 4, 2010)*
-
* The Mail::Message class has helped methods for all the field types that return 'common' defaults for the common use case, so to get the subject, mail.subject will give you a string, mail.date will give you a DateTime object, mail.from will give you an array of address specs (mikel@test.lindsaar.net) etc. If you want to access the field object itself, call mail[:field_name] which will return the field object you want, which you can then chain, like mail[:from].formatted
* Mail#content_type now returns the content_type field as a string. If you want the mime type of a mail, then you call Mail#mime_type (eg, text/plain), if you want the parameters of the content type field, you call Mail#content_type_parameters which gives you a hash, eg {'format' => 'flowed', 'charset' => 'utf-8'}
@@ -181,7 +179,7 @@
* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
-* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
+* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
@@ -327,7 +325,7 @@
* Added that deliver_* will now return the email that was sent
-* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
+* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
@@ -366,7 +364,7 @@
@body = "Nothing to see here."
@charset = "iso-8859-1"
end
-
+
def unencoded_subject(recipient)
@recipients = recipient
@subject = "testing unencoded subject"
@@ -375,7 +373,7 @@
@encode_subject = false
@charset = "iso-8859-1"
end
-
+
*0.6.1* (January 18th, 2005)
View
2  actionmailer/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2010 David Heinemeier Hansson
+Copyright (c) 2004-2011 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
35 actionmailer/README.rdoc
@@ -5,7 +5,7 @@ are used to consolidate code for sending out forgotten passwords, welcome
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.
-Action Mailer is in essence a wrapper around Action Controller and the
+Action Mailer is in essence a wrapper around Action Controller and the
Mail gem. It provides a way to make emails using templates in the same
way that Action Controller renders views using templates.
@@ -23,7 +23,7 @@ This can be as simple as:
class Notifier < ActionMailer::Base
delivers_from 'system@loudthinking.com'
-
+
def welcome(recipient)
@recipient = recipient
mail(:to => recipient,
@@ -36,13 +36,13 @@ ERb) that has the instance variables that are declared in the mailer action.
So the corresponding body template for the method above could look like this:
- Hello there,
+ Hello there,
Mr. <%= @recipient %>
Thank you for signing up!
-
-And if the recipient was given as "david@loudthinking.com", the email
+
+And if the recipient was given as "david@loudthinking.com", the email
generated would look like this:
Date: Mon, 25 Jan 2010 22:48:09 +1100
@@ -55,18 +55,18 @@ generated would look like this:
charset="US-ASCII";
Content-Transfer-Encoding: 7bit
- Hello there,
+ Hello there,
Mr. david@loudthinking.com
-In previous version of rails you would call <tt>create_method_name</tt> and
+In previous version of Rails you would call <tt>create_method_name</tt> and
<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface, you
simply call the method and optionally call +deliver+ on the return value.
Calling the method returns a Mail Message object:
- message = Notifier.welcome #=> Returns a Mail::Message object
- message.deliver #=> delivers the email
+ message = Notifier.welcome # => Returns a Mail::Message object
+ message.deliver # => delivers the email
Or you can just chain the methods together like:
@@ -74,10 +74,10 @@ Or you can just chain the methods together like:
== Receiving emails
-To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes a
-tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
+To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes an
+email object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called <tt>receive</tt>, that accepts a raw, unprocessed email as a string, which it then turns
-into the tmail object and calls the receive instance method.
+into the email object and calls the receive instance method.
Example:
@@ -90,7 +90,7 @@ Example:
if email.has_attachments?
for attachment in email.attachments
- page.attachments.create({
+ page.attachments.create({
:file => attachment, :description => email.subject
})
end
@@ -98,13 +98,13 @@ Example:
end
end
-This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
+This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
trivial case like this:
rails runner 'Mailman.receive(STDIN.read)'
-However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
-instance of Rails should be run within a daemon if it is going to be utilized to process more than just
+However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
+instance of Rails should be run within a daemon, if it is going to be utilized to process more than just
a limited number of email.
== Configuration
@@ -128,7 +128,7 @@ The latest version of Action Mailer can be installed with Rubygems:
Source code can be downloaded as part of the Rails project on GitHub
-* http://github.com/rails/rails/tree/master/actionmailer/
+* https://github.com/rails/rails/tree/master/actionmailer/
== License
@@ -145,3 +145,4 @@ API documentation is at
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
* https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
+
View
20 actionmailer/Rakefile 100644 → 100755
@@ -1,8 +1,5 @@
-gem 'rdoc', '>= 2.5.9'
-require 'rdoc'
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
-require 'rdoc/task'
require 'rake/packagetask'
require 'rake/gempackagetask'
@@ -20,24 +17,11 @@ namespace :test do
task :isolated do
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
Dir.glob("test/**/*_test.rb").all? do |file|
- system(ruby, '-Ilib:test', file)
+ sh(ruby, '-Ilib:test', file)
end or raise "Failures"
end
end
-# Generate the RDoc documentation
-RDoc::Task.new { |rdoc|
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "Action Mailer -- Easy email delivery and testing"
- rdoc.options << '--charset' << 'utf-8'
- rdoc.options << '-f' << 'horo'
- rdoc.options << '--main' << 'README.rdoc'
- rdoc.rdoc_files.include('README.rdoc', 'CHANGELOG')
- rdoc.rdoc_files.include('lib/action_mailer.rb')
- rdoc.rdoc_files.include('lib/action_mailer/*.rb')
- rdoc.rdoc_files.include('lib/action_mailer/delivery_method/*.rb')
-}
-
spec = eval(File.read('actionmailer.gemspec'))
Rake::GemPackageTask.new(spec) do |p|
View
2  actionmailer/actionmailer.gemspec
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
s.has_rdoc = true
s.add_dependency('actionpack', version)
- s.add_dependency('mail', '~> 2.2.5')
+ s.add_dependency('mail', '~> 2.2.15')
end
View
4 actionmailer/lib/action_mailer.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2010 David Heinemeier Hansson
+# Copyright (c) 2004-2011 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -26,6 +26,7 @@
require 'abstract_controller'
require 'action_view'
+require 'action_mailer/version'
# Common Active Support usage in Action Mailer
require 'active_support/core_ext/class'
@@ -43,7 +44,6 @@ module ActionMailer
autoload :Collector
autoload :Base
autoload :DeliveryMethods
- autoload :DeprecatedApi
autoload :MailHelper
autoload :OldApi
autoload :TestCase
View
36 actionmailer/lib/action_mailer/adv_attr_accessor.rb
@@ -1,26 +1,28 @@
module ActionMailer
module AdvAttrAccessor #:nodoc:
- def adv_attr_accessor(*names)
- names.each do |name|
- ivar = "@#{name}"
+ def adv_attr_accessor(name, deprecation=nil)
+ ivar = "@#{name}"
+ deprecation ||= "Please pass :#{name} as hash key to mail() instead"
- class_eval <<-ACCESSORS, __FILE__, __LINE__ + 1
- def #{name}=(value)
- #{ivar} = value
- end
+ class_eval <<-ACCESSORS, __FILE__, __LINE__ + 1
+ def #{name}=(value)
+ ActiveSupport::Deprecation.warn "#{name}= is deprecated. #{deprecation}"
+ #{ivar} = value
+ end
- def #{name}(*args)
- raise ArgumentError, "expected 0 or 1 parameters" unless args.length <= 1
- if args.empty?
- #{ivar} if instance_variable_names.include?(#{ivar.inspect})
- else
- #{ivar} = args.first
- end
+ def #{name}(*args)
+ raise ArgumentError, "expected 0 or 1 parameters" unless args.length <= 1
+ if args.empty?
+ ActiveSupport::Deprecation.warn "#{name}() is deprecated and will be removed in future versions."
+ #{ivar} if instance_variable_names.include?(#{ivar.inspect})
+ else
+ ActiveSupport::Deprecation.warn "#{name}(value) is deprecated. #{deprecation}"
+ #{ivar} = args.first
end
- ACCESSORS
+ end
+ ACCESSORS
- self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
- end
+ self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
end
end
end
View
92 actionmailer/lib/action_mailer/base.rb
@@ -187,31 +187,31 @@ module ActionMailer #:nodoc:
# with the filename +free_book.pdf+.
#
# = Inline Attachments
- #
- # You can also specify that a file should be displayed inline with other HTML. This is useful
+ #
+ # You can also specify that a file should be displayed inline with other HTML. This is useful
# if you want to display a corporate logo or a photo.
- #
+ #
# class ApplicationMailer < ActionMailer::Base
# def welcome(recipient)
# attachments.inline['photo.png'] = File.read('path/to/photo.png')
# mail(:to => recipient, :subject => "Here is what we look like")
# end
# end
- #
+ #
# And then to reference the image in the view, you create a <tt>welcome.html.erb</tt> file and
- # make a call to +image_tag+ passing in the attachment you want to display and then call
+ # make a call to +image_tag+ passing in the attachment you want to display and then call
# +url+ on the attachment to get the relative content id path for the image source:
- #
+ #
# <h1>Please Don't Cringe</h1>
- #
+ #
# <%= image_tag attachments['photo.png'].url -%>
- #
+ #
# As we are using Action View's +image_tag+ method, you can pass in any other options you want:
- #
+ #
# <h1>Please Don't Cringe</h1>
- #
+ #
# <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%>
- #
+ #
# = Observing and Intercepting Mails
#
# Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
@@ -222,7 +222,7 @@ module ActionMailer #:nodoc:
#
# An interceptor object must implement the <tt>:delivering_email(message)</tt> method which will be
# called before the email is sent, allowing you to make modifications to the email before it hits
- # the delivery agents. Your object should make and needed modifications directly to the passed
+ # the delivery agents. Your object should make any needed modifications directly to the passed
# in Mail::Message instance.
#
# = Default Hash
@@ -234,8 +234,8 @@ module ActionMailer #:nodoc:
# default :sender => 'system@example.com'
# end
#
- # You can pass in any header value that a <tt>Mail::Message</tt>, out of the box, <tt>ActionMailer::Base</tt>
- # sets the following:
+ # You can pass in any header value that a <tt>Mail::Message</tt> accepts. Out of the box,
+ # <tt>ActionMailer::Base</tt> sets the following:
#
# * <tt>:mime_version => "1.0"</tt>
# * <tt>:charset => "UTF-8",</tt>
@@ -246,7 +246,7 @@ module ActionMailer #:nodoc:
# but Action Mailer translates them appropriately and sets the correct values.
#
# As you can pass in any header, you need to either quote the header as a string, or pass it in as
- # an underscorised symbol, so the following will work:
+ # an underscored symbol, so the following will work:
#
# class Notifier < ActionMailer::Base
# default 'Content-Transfer-Encoding' => '7bit',
@@ -273,7 +273,7 @@ module ActionMailer #:nodoc:
# = Configuration options
#
# These options are specified on the class level, like
- # <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
+ # <tt>ActionMailer::Base.raise_delivery_errors = true</tt>
#
# * <tt>default</tt> - You can pass this in at a class level as well as within the class itself as
# per the above section.
@@ -290,13 +290,15 @@ module ActionMailer #:nodoc:
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the
# authentication type here.
- # This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
+ # This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
+ # send password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
+ # information and a cryptographic Message Digest 5 algorithm to hash important information)
# * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
# and starts to use it.
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
- # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@addres</tt>
+ # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt> with <tt>-f sender@address</tt>
# added automatically before the message is sent.
#
# * <tt>file_settings</tt> - Allows you to override options for the <tt>:file</tt> delivery method.
@@ -341,10 +343,11 @@ class Base < AbstractController::Base
include AbstractController::Translation
include AbstractController::AssetPaths
- helper ActionMailer::MailHelper
+ cattr_reader :protected_instance_variables
+ @@protected_instance_variables = []
+ helper ActionMailer::MailHelper
include ActionMailer::OldApi
- include ActionMailer::DeprecatedApi
delegate :register_observer, :to => Mail
delegate :register_interceptor, :to => Mail
@@ -360,7 +363,6 @@ class Base < AbstractController::Base
}.freeze
class << self
-
def mailer_name
@mailer_name ||= name.underscore
end
@@ -402,14 +404,14 @@ def deliver_mail(mail) #:nodoc:
end
end
- def respond_to?(method, *args) #:nodoc:
+ def respond_to?(method, include_private = false) #:nodoc:
super || action_methods.include?(method.to_s)
end
protected
def set_payload_for_mail(payload, mail) #:nodoc:
- payload[:mailer] = self.name
+ payload[:mailer] = name
payload[:message_id] = mail.message_id
payload[:subject] = mail.subject
payload[:to] = mail.to
@@ -421,11 +423,8 @@ def set_payload_for_mail(payload, mail) #:nodoc:
end
def method_missing(method, *args) #:nodoc:
- if action_methods.include?(method.to_s)
- new(method, *args).message
- else
- super
- end
+ return super unless respond_to?(method)
+ new(method, *args).message
end
end
@@ -446,6 +445,10 @@ def process(*args) #:nodoc:
super
end
+ def mailer_name
+ self.class.mailer_name
+ end
+
# Allows you to pass random and unusual headers to the new +Mail::Message+ object
# which will add them to itself.
#
@@ -690,15 +693,8 @@ def collect_responses_and_parts_order(headers) #:nodoc:
end
def each_template(paths, name, &block) #:nodoc:
- Array.wrap(paths).each do |path|
- templates = lookup_context.find_all(name, path)
- templates = templates.uniq_by { |t| t.formats }
-
- unless templates.empty?
- templates.each(&block)
- return
- end
- end
+ templates = lookup_context.find_all(name, Array.wrap(paths))
+ templates.uniq_by { |t| t.formats }.each(&block)
end
def create_parts_from_responses(m, responses) #:nodoc:
@@ -720,28 +716,6 @@ def insert_part(container, response, charset) #:nodoc:
container.add_part(part)
end
- module DeprecatedUrlOptions
- def default_url_options
- deprecated_url_options
- end
-
- def default_url_options=(val)
- deprecated_url_options
- end
-
- def deprecated_url_options
- raise "You can no longer call ActionMailer::Base.default_url_options " \
- "directly. You need to set config.action_mailer.default_url_options. " \
- "If you are using ActionMailer standalone, you need to include the " \
- "routing url_helpers directly."
- end
- end
-
- # This module will complain if the user tries to set default_url_options
- # directly instead of through the config object. In Action Mailer's Railtie,
- # we include the router's url_helpers, which will override this module.
- extend DeprecatedUrlOptions
-
ActiveSupport.run_load_hooks(:action_mailer, self)
end
end
View
4 actionmailer/lib/action_mailer/delivery_methods.rb
@@ -46,11 +46,11 @@ module ClassMethods
# as alias and the default options supplied:
#
# Example:
- #
+ #
# add_delivery_method :sendmail, Mail::Sendmail,
# :location => '/usr/sbin/sendmail',
# :arguments => '-i -t'
- #
+ #
def add_delivery_method(symbol, klass, default_options={})
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
View
141 actionmailer/lib/action_mailer/deprecated_api.rb
@@ -1,141 +0,0 @@
-require 'active_support/core_ext/object/try'
-
-module ActionMailer
- # This is the API which is deprecated and is going to be removed on Rails 3.1 release.
- # Part of the old API will be deprecated after 3.1, for a smoother deprecation process.
- # Check those in OldApi instead.
- module DeprecatedApi #:nodoc:
- extend ActiveSupport::Concern
-
- included do
- [:charset, :content_type, :mime_version, :implicit_parts_order].each do |method|
- class_eval <<-FILE, __FILE__, __LINE__ + 1
- def self.default_#{method}
- @@default_#{method}
- end
-
- def self.default_#{method}=(value)
- ActiveSupport::Deprecation.warn "ActionMailer::Base.default_#{method}=value is deprecated, " <<
- "use default :#{method} => value instead"
- @@default_#{method} = value
- end
-
- @@default_#{method} = nil
- FILE
- end
- end
-
- module ClassMethods
- # Deliver the given mail object directly. This can be used to deliver
- # a preconstructed mail object, like:
- #
- # email = MyMailer.create_some_mail(parameters)
- # email.set_some_obscure_header "frobnicate"
- # MyMailer.deliver(email)
- def deliver(mail, show_warning=true)
- if show_warning
- ActiveSupport::Deprecation.warn "#{self}.deliver is deprecated, call " <<
- "deliver in the mailer instance instead", caller[0,2]
- end
-
- raise "no mail object available for delivery!" unless mail
- wrap_delivery_behavior(mail)
- mail.deliver
- mail
- end
-
- def template_root
- self.view_paths && self.view_paths.first
- end
-
- def template_root=(root)
- ActiveSupport::Deprecation.warn "template_root= is deprecated, use prepend_view_path instead", caller[0,2]
- self.view_paths = ActionView::Base.process_view_paths(root)
- end
-
- def respond_to?(method_symbol, include_private = false)
- matches_dynamic_method?(method_symbol) || super
- end
-
- def method_missing(method_symbol, *parameters)
- if match = matches_dynamic_method?(method_symbol)
- case match[1]
- when 'create'
- ActiveSupport::Deprecation.warn "#{self}.create_#{match[2]} is deprecated, " <<
- "use #{self}.#{match[2]} instead", caller[0,2]
- new(match[2], *parameters).message
- when 'deliver'
- ActiveSupport::Deprecation.warn "#{self}.deliver_#{match[2]} is deprecated, " <<
- "use #{self}.#{match[2]}.deliver instead", caller[0,2]
- new(match[2], *parameters).message.deliver
- else super
- end
- else
- super
- end
- end
-
- private
-
- def matches_dynamic_method?(method_name)
- method_name = method_name.to_s
- /^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name)
- end
- end
-
- # Delivers a Mail object. By default, it delivers the cached mail
- # object (from the <tt>create!</tt> method). If no cached mail object exists, and
- # no alternate has been given as the parameter, this will fail.
- def deliver!(mail = @_message)
- ActiveSupport::Deprecation.warn "Calling deliver in the AM::Base object is deprecated, " <<
- "please call deliver in the Mail instance", caller[0,2]
- self.class.deliver(mail, false)
- end
- alias :deliver :deliver!
-
- def render(*args)
- options = args.last.is_a?(Hash) ? args.last : {}
-
- if options[:body].is_a?(Hash)
- ActiveSupport::Deprecation.warn(':body in render deprecated. Please use instance ' <<
- 'variables as assigns instead', caller[0,1])
-
- options[:body].each { |k,v| instance_variable_set(:"@#{k}", v) }
- end
- super
- end
-
- # Render a message but does not set it as mail body. Useful for rendering
- # data for part and attachments.
- #
- # Examples:
- #
- # render_message "special_message"
- # render_message :template => "special_message"
- # render_message :inline => "<%= 'Hi!' %>"
- #
- def render_message(*args)
- ActiveSupport::Deprecation.warn "render_message is deprecated, use render instead", caller[0,2]
- render(*args)
- end
-
- private
-
- def initialize_defaults(*)
- @charset ||= self.class.default_charset.try(:dup)
- @content_type ||= self.class.default_content_type.try(:dup)
- @implicit_parts_order ||= self.class.default_implicit_parts_order.try(:dup)
- @mime_version ||= self.class.default_mime_version.try(:dup)
- super
- end
-
- def create_parts
- if @body.is_a?(Hash) && !@body.empty?
- ActiveSupport::Deprecation.warn "Giving a hash to body is deprecated, please use instance variables instead", caller[0,2]
- @body.each { |k, v| instance_variable_set(:"@#{k}", v) }
- end
- super
- end
-
- end
-end
View
39 actionmailer/lib/action_mailer/mail_helper.rb
@@ -3,23 +3,14 @@ module MailHelper
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
- begin
- require 'text/format'
- rescue LoadError => e
- $stderr.puts "You don't have text-format installed in your application. Please add it to your Gemfile and run bundle install"
- raise e
- end unless defined?(Text::Format)
-
formatted = text.split(/\n\r\n/).collect { |paragraph|
- Text::Format.new(
- :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
- ).format
+ format_paragraph(paragraph)
}.join("\n")
-
+
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
-
+
formatted
end
@@ -37,5 +28,29 @@ def message
def attachments
@_message.attachments
end
+
+ # Returns +text+ wrapped at +len+ columns and indented +indent+ spaces.
+ #
+ # === Examples
+ #
+ # my_text = "Here is a sample text with more than 40 characters"
+ #
+ # format_paragraph(my_text, 25, 4)
+ # # => " Here is a sample text with\n more than 40 characters"
+ def format_paragraph(text, len = 72, indent = 2)
+ sentences = [[]]
+
+ text.split.each do |word|
+ if (sentences.last + [word]).join(' ').length > len
+ sentences << [word]
+ else
+ sentences.last << word
+ end
+ end
+
+ sentences.map { |sentence|
+ "#{" " * indent}#{sentence.join(' ')}"
+ }.join "\n"
+ end
end
end
View
72 actionmailer/lib/action_mailer/old_api.rb
@@ -8,9 +8,7 @@ module OldApi #:nodoc:
included do
extend ActionMailer::AdvAttrAccessor
-
- @@protected_instance_variables = %w(@parts)
- cattr_reader :protected_instance_variables
+ self.protected_instance_variables.concat %w(@parts @mail_was_called)
# Specify the BCC addresses for the message
adv_attr_accessor :bcc
@@ -42,11 +40,11 @@ module OldApi #:nodoc:
# The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses).
- adv_attr_accessor :recipients
+ adv_attr_accessor :recipients, "Please pass :to as hash key to mail() instead"
# The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent.
- adv_attr_accessor :sent_on
+ adv_attr_accessor :sent_on, "Please pass :date as hash key to mail() instead"
# Specify the subject of the message.
adv_attr_accessor :subject
@@ -54,20 +52,12 @@ module OldApi #:nodoc:
# Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template.
- adv_attr_accessor :template
-
- # Override the mailer name, which defaults to an inflected version of the
- # mailer's class name. If you want to use a template in a non-standard
- # location, you can use this to specify that location.
- adv_attr_accessor :mailer_name
+ adv_attr_accessor :template, "Please pass :template_name or :template_path as hash key to mail() instead"
# Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body
-
- # Alias controller_path to mailer_name so render :partial in views work.
- alias :controller_path :mailer_name
end
def process(method_name, *args)
@@ -84,6 +74,8 @@ def process(method_name, *args)
# part itself is yielded to the block so that other properties (charset,
# body, headers, etc.) can be set on it.
def part(params)
+ ActiveSupport::Deprecation.warn "part() is deprecated and will be removed in future versions. " <<
+ "Please pass a block to mail() instead."
params = {:content_type => params} if String === params
if custom_headers = params.delete(:headers)
@@ -99,6 +91,8 @@ def part(params)
# Add an attachment to a multipart message. This is simply a part with the
# content-disposition set to "attachment".
def attachment(params, &block)
+ ActiveSupport::Deprecation.warn "attachment() is deprecated and will be removed in future versions. " <<
+ "Please use the attachments[] API instead."
params = { :content_type => params } if String === params
params[:content] ||= params.delete(:data) || params.delete(:body)
@@ -116,43 +110,43 @@ def attachment(params, &block)
def normalize_nonfile_hash(params)
content_disposition = "attachment;"
-
+
mime_type = params.delete(:mime_type)
-
+
if content_type = params.delete(:content_type)
content_type = "#{mime_type || content_type};"
end
params[:body] = params.delete(:data) if params[:data]
-
+
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
-
+
def normalize_file_hash(params)
filename = File.basename(params.delete(:filename))
content_disposition = "attachment; filename=\"#{File.basename(filename)}\""
-
+
mime_type = params.delete(:mime_type)
-
+
if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/)
content_type = "#{mime_type || content_type}; filename=\"#{filename}\""
end
-
+
params[:body] = params.delete(:data) if params[:data]
-
+
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
- def create_mail
+ def create_mail
m = @_message
- set_fields!({:subject => subject, :to => recipients, :from => from,
- :bcc => bcc, :cc => cc, :reply_to => reply_to}, charset)
+ set_fields!({:subject => @subject, :to => @recipients, :from => @from,
+ :bcc => @bcc, :cc => @cc, :reply_to => @reply_to}, @charset)
- m.mime_version = mime_version unless mime_version.nil?
- m.date = sent_on.to_time rescue sent_on if sent_on
+ m.mime_version = @mime_version if @mime_version
+ m.date = @sent_on.to_time rescue @sent_on if @sent_on
@headers.each { |k, v| m[k] = v }
@@ -178,19 +172,21 @@ def create_mail
wrap_delivery_behavior!
m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii?
-
+
@_message
end
-
+
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.
- def initialize_defaults(method_name)
+ def initialize_defaults(method_name)
@charset ||= self.class.default[:charset].try(:dup)
@content_type ||= self.class.default[:content_type].try(:dup)
@implicit_parts_order ||= self.class.default[:parts_order].try(:dup)
@mime_version ||= self.class.default[:mime_version].try(:dup)
+ @cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil
+
@mailer_name ||= self.class.mailer_name.dup
@template ||= method_name
@mail_was_called = false
@@ -201,11 +197,11 @@ def initialize_defaults(method_name)
@body ||= {}
end
- def create_parts
+ def create_parts
if String === @body
@parts.unshift create_inline_part(@body)
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
- lookup_context.find_all(@template, @mailer_name).each do |template|
+ lookup_context.find_all(@template, [@mailer_name]).each do |template|
self.formats = template.formats
@parts << create_inline_part(render(:template => template), template.mime_type)
end
@@ -216,11 +212,11 @@ def create_parts
# If this is a multipart e-mail add the mime_version if it is not
# already set.
- @mime_version ||= "1.0" if !@parts.empty?
+ @mime_version ||= "1.0" unless @parts.empty?
end
end
- def create_inline_part(body, mime_type=nil)
+ def create_inline_part(body, mime_type=nil)
ct = mime_type || "text/plain"
main_type, sub_type = split_content_type(ct.to_s)
@@ -242,17 +238,17 @@ def set_fields!(headers, charset) #:nodoc:
m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to]
end
- def split_content_type(ct)
+ def split_content_type(ct)
ct.to_s.split("/")
end
- def parse_content_type(defaults=nil)
+ def parse_content_type
if @content_type.blank?
[ nil, {} ]
else
ctype, *attrs = @content_type.split(/;\s*/)
- attrs = attrs.inject({}) { |h,s| k,v = s.split(/\=/, 2); h[k] = v; h }
- [ctype, {"charset" => @charset}.merge(attrs)]
+ attrs = Hash[attrs.map { |attr| attr.split(/=/, 2) }]
+ [ctype, {"charset" => @charset}.merge!(attrs)]
end
end
end
View
23 actionmailer/lib/action_mailer/railtie.rb
@@ -1,5 +1,6 @@
require "action_mailer"
require "rails"
+require "abstract_controller/railties/routes_helpers"
module ActionMailer
class Railtie < Rails::Railtie
@@ -13,14 +14,26 @@ class Railtie < Rails::Railtie
paths = app.config.paths
options = app.config.action_mailer
- options.assets_dir ||= paths.public.to_a.first
- options.javascripts_dir ||= paths.public.javascripts.to_a.first
- options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
+ options.assets_dir ||= paths["public"].first
+ options.javascripts_dir ||= paths["public/javascripts"].first
+ options.stylesheets_dir ||= paths["public/stylesheets"].first
+
+ # make sure readers methods get compiled
+ options.asset_path ||= app.config.asset_path
+ options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_mailer) do
- include app.routes.url_helpers
+ include AbstractController::UrlFor
+ extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
+ include app.routes.mounted_helpers
options.each { |k,v| send("#{k}=", v) }
end
end
+
+ initializer "action_mailer.compile_config_methods" do
+ ActiveSupport.on_load(:action_mailer) do
+ config.compile_methods! if config.respond_to?(:compile_methods!)
+ end
+ end
end
-end
+end
View
7 actionmailer/lib/action_mailer/test_case.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/class/attribute'
+
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
@@ -15,11 +17,11 @@ module Behavior
module ClassMethods
def tests(mailer)
- write_inheritable_attribute(:mailer_class, mailer)
+ self._mailer_class = mailer
end
def mailer_class
- if mailer = read_inheritable_attribute(:mailer_class)
+ if mailer = self._mailer_class
mailer
else
tests determine_default_mailer(name)
@@ -65,6 +67,7 @@ def read_fixture(action)
end
included do
+ class_attribute :_mailer_class
setup :initialize_test_deliveries
setup :set_expected_mail
end
View
27 actionmailer/lib/action_mailer/tmail_compat.rb
@@ -1,17 +1,19 @@
module Mail
class Message
-
+
def set_content_type(*args)
- ActiveSupport::Deprecation.warn('Message#set_content_type is deprecated, please just call ' <<
- 'Message#content_type with the same arguments', caller[0,2])
+ message = 'Message#set_content_type is deprecated, please just call ' <<
+ 'Message#content_type with the same arguments'
+ ActiveSupport::Deprecation.warn(message, caller[0,2])
content_type(*args)
end
-
+
alias :old_transfer_encoding :transfer_encoding
def transfer_encoding(value = nil)
if value
- ActiveSupport::Deprecation.warn('Message#transfer_encoding is deprecated, please call ' <<
- 'Message#content_transfer_encoding with the same arguments', caller[0,2])
+ message = 'Message#transfer_encoding is deprecated, ' <<
+ 'please call Message#content_transfer_encoding with the same arguments'
+ ActiveSupport::Deprecation.warn(message, caller[0,2])
content_transfer_encoding(value)
else
old_transfer_encoding
@@ -19,16 +21,17 @@ def transfer_encoding(value = nil)
end
def transfer_encoding=(value)
- ActiveSupport::Deprecation.warn('Message#transfer_encoding= is deprecated, please call ' <<
- 'Message#content_transfer_encoding= with the same arguments', caller[0,2])
+ message = 'Message#transfer_encoding= is deprecated, ' <<
+ 'please call Message#content_transfer_encoding= with the same arguments'
+ ActiveSupport::Deprecation.warn(message, caller[0,2])
self.content_transfer_encoding = value
end
def original_filename
- ActiveSupport::Deprecation.warn('Message#original_filename is deprecated, ' <<
- 'please call Message#filename', caller[0,2])
+ message = 'Message#original_filename is deprecated, please call Message#filename'
+ ActiveSupport::Deprecation.warn(message, caller[0,2])
filename
end
-
+
end
-end
+end
View
6 actionmailer/lib/action_mailer/version.rb
@@ -1,10 +1,10 @@
module ActionMailer
module VERSION #:nodoc:
MAJOR = 3
- MINOR = 0
+ MINOR = 1
TINY = 0
- BUILD = "rc"
+ PRE = "beta"
- STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
end
end
View
5 actionmailer/lib/rails/generators/mailer/USAGE
@@ -1,4 +1,5 @@
Description:
+============
Stubs out a new mailer and its views. Pass the mailer name, either
CamelCased or under_scored, and an optional list of emails as arguments.
@@ -6,10 +7,12 @@ Description:
engine and test framework generators.
Example:
- `rails generate mailer Notifications signup forgot_password invoice`
+========
+ rails generate mailer Notifications signup forgot_password invoice
creates a Notifications mailer class, views, test, and fixtures:
Mailer: app/mailers/notifications.rb
Views: app/views/notifications/signup.erb [...]
Test: test/functional/notifications_test.rb
Fixtures: test/fixtures/notifications/signup [...]
+
View
4 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
@@ -1,3 +1,4 @@
+<% module_namespacing do -%>
class <%= class_name %> < ActionMailer::Base
default :from => "from@example.com"
<% for action in actions -%>
@@ -5,7 +6,7 @@ class <%= class_name %> < ActionMailer::Base
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
- # en.<%= file_name %>.<%= action %>.subject
+ # en.<%= file_path.gsub("/",".") %>.<%= action %>.subject
#
def <%= action %>
@greeting = "Hi"
@@ -14,3 +15,4 @@ def <%= action %>
end
<% end -%>
end
+<% end -%>
View
17 actionmailer/test/abstract_unit.rb
@@ -11,11 +11,20 @@
$VERBOSE = old
end
-
require 'active_support/core_ext/kernel/reporting'
+
+require 'active_support/core_ext/string/encoding'
+if "ruby".encoding_aware?
+ # 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
+end
+
silence_warnings do
# These external dependencies have warnings :/
- require 'text/format'
require 'mail'
end
@@ -67,4 +76,6 @@ def set_delivery_method(method)
def restore_delivery_method
ActionMailer::Base.delivery_method = @old_delivery_method
-end
+end
+
+ActiveSupport::Deprecation.silenced = true
View
10 actionmailer/test/old_base/asset_host_test.rb → actionmailer/test/asset_host_test.rb
@@ -3,9 +3,9 @@
class AssetHostMailer < ActionMailer::Base
def email_with_asset
- recipients 'test@localhost'
- subject "testing email containing asset path while asset_host is set"
- from "tester@example.com"
+ mail :to => 'test@localhost',
+ :subject => 'testing email containing asset path while asset_host is set',
+ :from => 'tester@example.com'
end
end
@@ -29,7 +29,7 @@ def test_asset_host_as_string
assert_equal %Q{<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />}, mail.body.to_s.strip
end
- def test_asset_host_as_one_arguement_proc
+ def test_asset_host_as_one_argument_proc
AssetHostMailer.config.asset_host = Proc.new { |source|
if source.starts_with?('/images')
"http://images.example.com"
@@ -41,7 +41,7 @@ def test_asset_host_as_one_arguement_proc
assert_equal %Q{<img alt="Somelogo" src="http://images.example.com/images/somelogo.png" />}, mail.body.to_s.strip
end
- def test_asset_host_as_two_arguement_proc
+ def test_asset_host_as_two_argument_proc
ActionController::Base.config.asset_host = Proc.new {|source,request|
if request && request.ssl?
"https://www.example.com"
View
35 actionmailer/test/base_test.rb
@@ -7,9 +7,6 @@
require 'mailers/asset_mailer'
class BaseTest < ActiveSupport::TestCase
- # TODO Add some tests for implicity layout render and url helpers
- # so we can get rid of old base tests altogether with old base.
-
def teardown
ActionMailer::Base.asset_host = nil
ActionMailer::Base.assets_dir = nil
@@ -35,21 +32,21 @@ def teardown
end
test "mail() with bcc, cc, content_type, charset, mime_version, reply_to and date" do
- @time = Time.now.beginning_of_day.to_datetime
+ time = Time.now.beginning_of_day.to_datetime
email = BaseMailer.welcome(:bcc => 'bcc@test.lindsaar.net',
:cc => 'cc@test.lindsaar.net',
:content_type => 'multipart/mixed',
:charset => 'iso-8559-1',
:mime_version => '2.0',
:reply_to => 'reply-to@test.lindsaar.net',
- :date => @time)
+ :date => time)
assert_equal(['bcc@test.lindsaar.net'], email.bcc)
assert_equal(['cc@test.lindsaar.net'], email.cc)
assert_equal('multipart/mixed; charset=iso-8559-1', email.content_type)
assert_equal('iso-8559-1', email.charset)
assert_equal('2.0', email.mime_version)
assert_equal(['reply-to@test.lindsaar.net'], email.reply_to)
- assert_equal(@time, email.date)
+ assert_equal(time, email.date)
end
test "mail() renders the template using the method being processed" do
@@ -148,7 +145,7 @@ def teardown
assert_equal("application/pdf", email.parts[1].mime_type)
assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded)
end
-
+
test "can embed an inline attachment" do
email = BaseMailer.inline_attachment
# Need to call #encoded to force the JIT sort on parts
@@ -156,8 +153,8 @@ def teardown
assert_equal(2, email.parts.length)
assert_equal("multipart/related", email.mime_type)
assert_equal("multipart/alternative", email.parts[0].mime_type)
- assert_equal("text/plain", email.parts[0].parts[0].mime_type)