aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/rails_generator/generators/components/controller/controller_generator.rb3
-rw-r--r--railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb14
-rw-r--r--railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml2
-rw-r--r--railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb3
-rw-r--r--railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml2
6 files changed, 15 insertions, 11 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 634caf4ffb..a5c1963047 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Mailer generator: handle mailers in modules, set mime_version in unit test. [Jeremy Kemper]
+
* Set $KCODE to 'u' by default to enable the multibyte safe String#chars proxy. [Koz]
* Added config.plugins to control which plugins are loaded #6269 [skaes]. By default, everything in vendor/plugins will be loaded, but if you specify config.plugins, only those will be loaded. Example:
diff --git a/railties/lib/rails_generator/generators/components/controller/controller_generator.rb b/railties/lib/rails_generator/generators/components/controller/controller_generator.rb
index 358d357432..c6703b4a17 100644
--- a/railties/lib/rails_generator/generators/components/controller/controller_generator.rb
+++ b/railties/lib/rails_generator/generators/components/controller/controller_generator.rb
@@ -29,8 +29,7 @@ class ControllerGenerator < Rails::Generator::NamedBase
# View template for each action.
actions.each do |action|
path = File.join('app/views', class_path, file_name, "#{action}.rhtml")
- m.template 'view.rhtml',
- path,
+ m.template 'view.rhtml', path,
:assigns => { :action => action, :path => path }
end
end
diff --git a/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb b/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb
index bac0cb0175..afdb17b5ac 100644
--- a/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb
+++ b/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb
@@ -20,12 +20,14 @@ class MailerGenerator < Rails::Generator::NamedBase
# View template and fixture for each action.
actions.each do |action|
- m.template "view.rhtml",
- File.join('app/views', class_path, file_name, "#{action}.rhtml"),
- :assigns => { :action => action }
- m.template "fixture.rhtml",
- File.join('test/fixtures', class_path, file_name, action),
- :assigns => { :action => action }
+ relative_path = File.join(class_path, file_name, "#{action}.rhtml")
+ view_path = File.join('app/views', relative_path)
+ fixture_path = File.join('test/fixtures', relative_path)
+
+ m.template "view.rhtml", view_path,
+ :assigns => { :action => action, :path => view_path }
+ m.template "fixture.rhtml", fixture_path,
+ :assigns => { :action => action, :path => fixture_path }
end
end
end
diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
index b481906829..6899257ddc 100644
--- a/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
+++ b/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
@@ -1,3 +1,3 @@
<%= class_name %>#<%= action %>
-Find me in app/views/<%= file_name %>/<%= action %>.rhtml
+Find me in <%= path %>
diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb b/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
index 0512cad5fa..d7b5ee0eb3 100644
--- a/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
+++ b/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/../test_helper'
+require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
require '<%= file_name %>'
class <%= class_name %>Test < Test::Unit::TestCase
@@ -14,6 +14,7 @@ class <%= class_name %>Test < Test::Unit::TestCase
@expected = TMail::Mail.new
@expected.set_content_type "text", "plain", { "charset" => CHARSET }
+ @expected.mime_version = '1.0'
end
<% for action in actions -%>
diff --git a/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml b/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml
index b481906829..6899257ddc 100644
--- a/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml
+++ b/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml
@@ -1,3 +1,3 @@
<%= class_name %>#<%= action %>
-Find me in app/views/<%= file_name %>/<%= action %>.rhtml
+Find me in <%= path %>