diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-20 19:33:14 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-20 19:33:14 +0000 |
commit | 1742d0d707ce395398b43063aba37e8c3606d378 (patch) | |
tree | cd520b4b97b19a3e04fbd891d8ec569301305796 /railties | |
parent | ef8f41dc687b08963ae5bb200a3f95208e6107a2 (diff) | |
download | rails-1742d0d707ce395398b43063aba37e8c3606d378.tar.gz rails-1742d0d707ce395398b43063aba37e8c3606d378.tar.bz2 rails-1742d0d707ce395398b43063aba37e8c3606d378.zip |
mailer unit test handles nested fixture paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5329 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb | 6 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb | 5 |
2 files changed, 5 insertions, 6 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 e07f7efd43..764707da4c 100644 --- a/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb +++ b/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb @@ -6,9 +6,9 @@ class MailerGenerator < Rails::Generator::NamedBase # Mailer, view, test, and fixture directories. m.directory File.join('app/models', class_path) - m.directory File.join('app/views', class_path, file_name) + m.directory File.join('app/views', file_path) m.directory File.join('test/unit', class_path) - m.directory File.join('test/fixtures', class_path, file_name) + m.directory File.join('test/fixtures', file_path) # Mailer class and unit test. m.template "mailer.rb", File.join('app/models', @@ -20,7 +20,7 @@ class MailerGenerator < Rails::Generator::NamedBase # View template and fixture for each action. actions.each do |action| - relative_path = File.join(class_path, file_name, action) + relative_path = File.join(file_path, action) view_path = File.join('app/views', "#{relative_path}.rhtml") fixture_path = File.join('test/fixtures', relative_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 d7b5ee0eb3..8cb816efc0 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,8 +1,7 @@ require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper' -require '<%= file_name %>' class <%= class_name %>Test < Test::Unit::TestCase - FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures' + FIXTURES_PATH = File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../fixtures' CHARSET = "utf-8" include ActionMailer::Quoting @@ -29,7 +28,7 @@ class <%= class_name %>Test < Test::Unit::TestCase <% end -%> private def read_fixture(action) - IO.readlines("#{FIXTURES_PATH}/<%= file_name %>/#{action}") + IO.readlines("#{FIXTURES_PATH}/<%= file_path %>/#{action}") end def encode(subject) |