diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-01-08 08:55:07 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-01-08 22:21:54 +0900 |
commit | af3eb5961e55a46b011be797e71f615f20f56686 (patch) | |
tree | 2c3329ce51dc71eeb8ae36f319f30add1b07279a /railties/lib/rails/generators/test_unit/mailer | |
parent | 9892d445bcff57f0a8bd8eb467cb7bf8c40a285b (diff) | |
download | rails-af3eb5961e55a46b011be797e71f615f20f56686.tar.gz rails-af3eb5961e55a46b011be797e71f615f20f56686.tar.bz2 rails-af3eb5961e55a46b011be797e71f615f20f56686.zip |
follow up to #18074
* ignore mailer suffix when generate test files
* add mailer suffix to view files
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 |