diff options
Diffstat (limited to 'railties/lib/rails_generator/generators/components/mailer')
4 files changed, 12 insertions, 9 deletions
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 %> |