diff options
Diffstat (limited to 'railties/lib/rails/generators/test_unit/mailer')
-rw-r--r-- | railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb b/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb index ba131da79d..343c8a3949 100644 --- a/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +++ b/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb @@ -16,6 +16,11 @@ module TestUnit # :nodoc: def create_preview_files template "preview.rb", File.join('test/mailers/previews', class_path, "#{file_name}_mailer_preview.rb") end + + protected + def file_name + @_file_name ||= super.gsub(/\_mailer/i, '') + end end end end diff --git a/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb index 3cee517db3..a2f2d30de5 100644 --- a/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +++ b/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb @@ -4,7 +4,7 @@ require 'test_helper' class <%= class_name %>MailerTest < ActionMailer::TestCase <% actions.each do |action| -%> test "<%= action %>" do - mail = <%= class_name %>.<%= action %> + mail = <%= class_name %>Mailer.<%= action %> assert_equal <%= action.to_s.humanize.inspect %>, mail.subject assert_equal ["to@example.org"], mail.to assert_equal ["from@example.com"], mail.from |