Permalink
Browse files

Merge remote branch 'mainstream/master'

Conflicts:
	activemodel/lib/active_model/state_machine.rb
  • Loading branch information...
2 parents c6af337 + b3a0282 commit ed60021f39f7913537dcad181e4061e423dc6c3d @lifo lifo committed Jan 31, 2010
Showing with 951 additions and 3,920 deletions.
  1. +9 −1 actionmailer/lib/action_mailer.rb
  2. +1 −6 actionmailer/lib/action_mailer/base.rb
  3. +4 −0 actionmailer/lib/action_mailer/railtie.rb
  4. +7 −1 actionmailer/lib/action_mailer/tmail_compat.rb
  5. +43 −13 actionmailer/test/base_test.rb
  6. +1 −0 actionmailer/test/fixtures/base_mailer/different_layout.html.erb
  7. +1 −0 actionmailer/test/fixtures/base_mailer/different_layout.text.erb
  8. +1 −0 actionmailer/test/fixtures/base_mailer/email_custom_layout.text.html.erb
  9. +1 −0 actionmailer/test/fixtures/layouts/different_layout.html.erb
  10. +1 −0 actionmailer/test/fixtures/layouts/different_layout.text.erb
  11. +10 −0 actionmailer/test/old_base/tmail_compat_test.rb
  12. +5 −0 actionmailer/test/old_base/url_test.rb
  13. +34 −43 actionpack/README
  14. +2 −1 actionpack/lib/abstract_controller.rb
  15. +18 −0 actionpack/lib/abstract_controller/compatibility.rb
  16. +11 −1 actionpack/lib/abstract_controller/helpers.rb
  17. +12 −2 actionpack/lib/abstract_controller/rendering.rb
  18. +0 −156 actionpack/lib/abstract_controller/url_for.rb
  19. +4 −6 actionpack/lib/action_controller.rb
  20. +8 −0 actionpack/lib/action_controller/base.rb
  21. +1 −1 actionpack/lib/action_controller/deprecated.rb
  22. +2 −13 actionpack/lib/action_controller/metal/compatibility.rb
  23. +2 −15 actionpack/lib/action_controller/metal/helpers.rb
  24. +0 −5 actionpack/lib/action_controller/metal/rendering.rb
  25. +145 −4 actionpack/lib/action_controller/metal/url_for.rb
  26. +1 −0 actionpack/lib/action_dispatch.rb
  27. +5 −0 actionpack/lib/action_dispatch/testing/test_response.rb
  28. +11 −6 actionpack/lib/action_view/base.rb
  29. +4 −3 actionpack/lib/action_view/helpers.rb
  30. +0 −713 actionpack/lib/action_view/helpers/ajax_helper.rb
  31. +1 −1 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  32. +16 −20 actionpack/lib/action_view/helpers/form_helper.rb
  33. +5 −6 actionpack/lib/action_view/helpers/form_tag_helper.rb
  34. +1 −151 actionpack/lib/action_view/helpers/javascript_helper.rb
  35. +93 −77 actionpack/lib/action_view/helpers/prototype_helper.rb
  36. +89 −53 actionpack/lib/action_view/helpers/scriptaculous_helper.rb
  37. +61 −19 actionpack/lib/action_view/helpers/url_helper.rb
  38. +1 −1 actionpack/lib/action_view/paths.rb
  39. +41 −2 actionpack/test/abstract/render_test.rb
  40. +2 −2 actionpack/test/controller/assert_select_test.rb
  41. +10 −11 actionpack/test/controller/helper_test.rb
  42. +1 −1 actionpack/test/controller/mime_responds_test.rb
  43. +18 −27 actionpack/test/controller/request_forgery_protection_test.rb
  44. +7 −7 actionpack/test/{abstract → controller}/url_for_test.rb
  45. +0 −452 actionpack/test/template/ajax_helper_test.rb
  46. +7 −8 actionpack/test/template/asset_tag_helper_test.rb
  47. +0 −29 actionpack/test/template/form_helper_test.rb
  48. +5 −5 actionpack/test/template/form_tag_helper_test.rb
  49. +0 −29 actionpack/test/template/javascript_helper_test.rb
  50. +0 −2 actionpack/test/template/prototype_helper_test.rb
  51. +10 −33 actionpack/test/template/url_helper_test.rb
  52. +0 −1 activemodel/lib/active_model.rb
  53. +14 −7 activemodel/lib/active_model/errors.rb
  54. +0 −219 activemodel/lib/active_model/state_machine.rb
  55. +0 −62 activemodel/lib/active_model/state_machine/event.rb
  56. +0 −75 activemodel/lib/active_model/state_machine/machine.rb
  57. +0 −47 activemodel/lib/active_model/state_machine/state.rb
  58. +0 −40 activemodel/lib/active_model/state_machine/state_transition.rb
  59. +0 −49 activemodel/test/cases/state_machine/event_test.rb
  60. +0 −43 activemodel/test/cases/state_machine/machine_test.rb
  61. +0 −72 activemodel/test/cases/state_machine/state_test.rb
  62. +0 −84 activemodel/test/cases/state_machine/state_transition_test.rb
  63. +0 −312 activemodel/test/cases/state_machine_test.rb
  64. +14 −14 activemodel/test/cases/validations/i18n_validation_test.rb
  65. +0 −1 activerecord/lib/active_record.rb
  66. +12 −12 activerecord/lib/active_record/locale/en.yml
  67. +1 −13 activerecord/lib/active_record/railtie.rb
  68. +1 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  69. +0 −24 activerecord/lib/active_record/state_machine.rb
  70. +2 −2 activerecord/lib/active_record/validations.rb
  71. +2 −2 activerecord/test/cases/autosave_association_test.rb
  72. +0 −42 activerecord/test/cases/state_machine_test.rb
  73. +7 −7 activerecord/test/cases/validations/i18n_validation_test.rb
  74. +0 −27 activerecord/test/models/traffic_light.rb
  75. +27 −53 activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
  76. +0 −34 activesupport/test/core_ext/class/delegating_attributes_test.rb
  77. +4 −0 railties/Rakefile
  78. +0 −152 railties/lib/generators/rails/app/templates/public/javascripts/jquery-1.4.1.min.js
  79. +0 −239 railties/lib/generators/rails/app/templates/public/javascripts/jquery.rails.js
  80. +0 −324 railties/lib/generators/rails/app/templates/public/javascripts/prototype.rails.js
  81. +77 −0 railties/lib/generators/rails/app/templates/public/javascripts/rails.js
  82. +0 −1 railties/lib/rails/commands/destroy.rb
  83. +0 −1 railties/lib/rails/commands/generate.rb
  84. +10 −10 railties/lib/rails/configuration.rb
  85. +3 −0 railties/lib/rails/generators.rb
  86. +12 −17 railties/lib/rails/initializable.rb
  87. +1 −1 railties/lib/rails/plugin.rb
  88. +2 −2 railties/lib/rails/test_unit/railtie.rb
  89. 0 railties/lib/rails/{tasks → test_unit}/testing.rake
  90. +7 −0 railties/test/application/configuration_test.rb
  91. +1 −1 railties/test/generators/generators_test_helper.rb
  92. +41 −2 railties/test/initializable_test.rb
  93. +1 −1 railties/test/railties/plugin_test.rb
@@ -24,9 +24,17 @@
actionpack_path = File.expand_path('../../../actionpack/lib', __FILE__)
$:.unshift(actionpack_path) if File.directory?(actionpack_path) && !$:.include?(actionpack_path)
-require 'action_controller'
+require 'abstract_controller'
require 'action_view'
+# Common ActiveSupport usage in ActionMailer
+require 'active_support/core_ext/class'
+require 'active_support/core_ext/object/blank'
+require 'active_support/core_ext/array/uniq_by'
+require 'active_support/core_ext/module/attr_internal'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/string/inflections'
+
module ActionMailer
extend ::ActiveSupport::Autoload
@@ -1,8 +1,3 @@
-require 'active_support/core_ext/class'
-require 'active_support/core_ext/object/blank'
-require 'active_support/core_ext/array/uniq_by'
-require 'active_support/core_ext/module/delegation'
-require 'active_support/core_ext/string/inflections'
require 'mail'
require 'action_mailer/tmail_compat'
require 'action_mailer/collector'
@@ -263,8 +258,8 @@ class Base < AbstractController::Base
include AbstractController::LocalizedCache
include AbstractController::Layouts
include AbstractController::Helpers
- include AbstractController::UrlFor
include AbstractController::Translation
+ include AbstractController::Compatibility
helper ActionMailer::MailHelper
@@ -17,5 +17,9 @@ class Railtie < Rails::Railtie
ActionMailer::Base.send "#{k}=", v
end
end
+
+ initializer "action_mailer.url_for" do |app|
+ ActionMailer::Base.send(:include, ActionController::UrlFor) if defined?(ActionController)
+ end
end
end
@@ -17,7 +17,13 @@ def transfer_encoding(value = nil)
old_transfer_encoding
end
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])
+ self.content_transfer_encoding = value
+ end
+
def original_filename
ActiveSupport::Deprecation.warn('Message#original_filename is deprecated, ' <<
'please call Message#filename', caller[0,2])
@@ -78,6 +78,23 @@ def custom_block(include_html=false)
format.html{ render "welcome" } if include_html
end
end
+
+ def different_template(template_name='')
+ mail do |format|
+ format.text { render :template => template_name }
+ format.html { render :template => template_name }
+ end
+ end
+
+ def different_layout(layout_name='')
+ mail do |format|
+ format.text {
+ render :layout => layout_name
+ }
+ format.html { render :layout => layout_name }
+ end
+ end
+
end
test "method call to mail does not raise error" do
@@ -398,6 +415,21 @@ def custom_block(include_html=false)
assert_equal("7bit", email.parts[1].content_transfer_encoding)
end
+ test "explicit multipart should be multipart" do
+ mail = BaseMailer.explicit_multipart
+ assert_not_nil(mail.content_type_parameters[:boundary])
+ end
+
+ test "should set a content type if only has an html part" do
+ mail = BaseMailer.html_only
+ assert_equal('text/html', mail.mime_type)
+ end
+
+ test "should set a content type if only has an plain text part" do
+ mail = BaseMailer.plain_text_only
+ assert_equal('text/plain', mail.mime_type)
+ end
+
test "explicit multipart with one part is rendered as body" do
email = BaseMailer.custom_block
assert_equal(0, email.parts.size)
@@ -439,20 +471,18 @@ def custom_block(include_html=false)
BaseMailer.expects(:welcome).returns(mail)
BaseMailer.welcome.deliver
end
-
- test "explicit multipart should be multipart" do
- mail = BaseMailer.explicit_multipart
- assert_not_nil(mail.content_type_parameters[:boundary])
- end
-
- test "should set a content type if only has an html part" do
- mail = BaseMailer.html_only
- assert_equal('text/html', mail.mime_type)
+
+ # Rendering
+ test "that you can specify a different template" do
+ mail = BaseMailer.different_template('explicit_multipart_templates')
+ assert_equal("HTML Explicit Multipart Templates", mail.html_part.body.decoded)
+ assert_equal("TEXT Explicit Multipart Templates", mail.text_part.body.decoded)
end
-
- test "should set a content type if only has an plain text part" do
- mail = BaseMailer.plain_text_only
- assert_equal('text/plain', mail.mime_type)
+
+ test "that you can specify a different layout" do
+ mail = BaseMailer.different_layout('different_layout')
+ assert_equal("HTML -- HTML", mail.html_part.body.decoded)
+ assert_equal("PLAIN -- PLAIN", mail.text_part.body.decoded)
end
protected
@@ -0,0 +1 @@
+HTML -- <%= yield %>
@@ -0,0 +1 @@
+PLAIN -- <%= yield %>
@@ -21,5 +21,15 @@ def test_transfer_encoding_raises_deprecation_warning
end
assert_equal mail.content_transfer_encoding, "base64"
end
+
+ def test_transfer_encoding_setter_raises_deprecation_warning
+ mail = Mail.new
+ assert_deprecated do
+ assert_nothing_raised do
+ mail.transfer_encoding = "base64"
+ end
+ end
+ assert_equal mail.content_transfer_encoding, "base64"
+ end
end
@@ -1,8 +1,13 @@
require 'abstract_unit'
+require 'action_controller'
class WelcomeController < ActionController::Base
end
+class ActionMailer::Base
+ include ActionController::UrlFor
+end
+
class TestMailer < ActionMailer::Base
default_url_options[:host] = 'www.basecamphq.com'
Oops, something went wrong.

0 comments on commit ed60021

Please sign in to comment.