diff options
Diffstat (limited to 'railties')
5 files changed, 11 insertions, 20 deletions
diff --git a/railties/lib/generators/erb/controller/controller_generator.rb b/railties/lib/generators/erb/controller/controller_generator.rb index d78bcba1b8..b8e8898900 100644 --- a/railties/lib/generators/erb/controller/controller_generator.rb +++ b/railties/lib/generators/erb/controller/controller_generator.rb @@ -11,7 +11,7 @@ module Erb actions.each do |action| @action = action - @path = filename_with_extensions(File.join(base_path, action)) + @path = File.join(base_path, filename_with_extensions(action)) template filename_with_extensions(:view), @path end end diff --git a/railties/lib/generators/test_unit/mailer/mailer_generator.rb b/railties/lib/generators/test_unit/mailer/mailer_generator.rb index a0d73db1b0..1b5985db6d 100644 --- a/railties/lib/generators/test_unit/mailer/mailer_generator.rb +++ b/railties/lib/generators/test_unit/mailer/mailer_generator.rb @@ -9,13 +9,6 @@ module TestUnit def create_test_files template "functional_test.rb", File.join('test/functional', class_path, "#{file_name}_test.rb") end - - def create_fixtures_files - actions.each do |action| - @action, @path = action, File.join(file_path, action) - template "fixture", File.join("test/fixtures", @path) - end - end end end end diff --git a/railties/lib/generators/test_unit/mailer/templates/fixture b/railties/lib/generators/test_unit/mailer/templates/fixture deleted file mode 100644 index 171648d6fd..0000000000 --- a/railties/lib/generators/test_unit/mailer/templates/fixture +++ /dev/null @@ -1,3 +0,0 @@ -<%= class_name %>#<%= @action %> - -Hi, find me in app/views/<%= @path %> diff --git a/railties/lib/generators/test_unit/mailer/templates/functional_test.rb b/railties/lib/generators/test_unit/mailer/templates/functional_test.rb index a2b1f1ed05..0d7c517557 100644 --- a/railties/lib/generators/test_unit/mailer/templates/functional_test.rb +++ b/railties/lib/generators/test_unit/mailer/templates/functional_test.rb @@ -3,12 +3,11 @@ require 'test_helper' class <%= class_name %>Test < ActionMailer::TestCase <% for action in actions -%> test "<%= action %>" do - @expected.subject = <%= action.to_s.humanize.inspect %> - @expected.to = "to@example.org" - @expected.from = "from@example.com" - @expected.body = read_fixture("<%= action %>") - - assert_equal @expected, <%= class_name %>.<%= action %> + mail = <%= class_name %>.<%= action %> + assert_equal <%= action.to_s.humanize.inspect %>, mail.subject + assert_equal ["to@example.org"], mail.to + assert_equal ["from@example.com"], mail.from + assert_match "Hi, find me in app", mail.body.encoded end <% end -%> diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 47c0b1186b..e4fccb33ed 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -28,9 +28,11 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_invokes_default_test_framework run_generator - assert_file "test/functional/notifier_test.rb", /class NotifierTest < ActionMailer::TestCase/ - assert_file "test/fixtures/notifier/foo", /app\/views\/notifier\/foo$/ - assert_file "test/fixtures/notifier/bar", /app\/views\/notifier\/bar$/ + assert_file "test/functional/notifier_test.rb" do |test| + assert_match /class NotifierTest < ActionMailer::TestCase/, test + assert_match /test "foo"/, test + assert_match /test "bar"/, test + end end def test_invokes_default_template_engine |