提交 c7255386 编写于 作者: J José Valim

`script/generate mailer Notifier` will now create a mailer at app/mailers.

上级 a18dd52d
......@@ -9,7 +9,7 @@ Example:
`./script/generate mailer Notifications signup forgot_password invoice`
creates a Notifications mailer class, views, test, and fixtures:
Mailer: app/models/notifications.rb
Mailer: app/mailers/notifications.rb
Views: app/views/notifications/signup.erb [...]
Test: test/unit/test/unit/notifications_test.rb
Test: test/functional/notifications_test.rb
Fixtures: test/fixtures/notifications/signup [...]
......@@ -5,7 +5,7 @@ class MailerGenerator < NamedBase
check_class_collision
def create_mailer_file
template "mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
template "mailer.rb", File.join('app/mailers', class_path, "#{file_name}.rb")
end
hook_for :template_engine, :test_framework
......
......@@ -7,7 +7,7 @@ class MailerGenerator < Base
check_class_collision :suffix => "Test"
def create_test_files
template "unit_test.rb", File.join('test/unit', class_path, "#{file_name}_test.rb")
template "functional_test.rb", File.join('test/functional', class_path, "#{file_name}_test.rb")
end
def create_fixtures_files
......
......@@ -7,7 +7,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase
def test_mailer_skeleton_is_created
run_generator
assert_file "app/models/notifier.rb", /class Notifier < ActionMailer::Base/
assert_file "app/mailers/notifier.rb", /class Notifier < ActionMailer::Base/
end
def test_check_class_collision
......@@ -17,7 +17,7 @@ def test_check_class_collision
def test_invokes_default_test_framework
run_generator
assert_file "test/unit/notifier_test.rb", /class NotifierTest < ActionMailer::TestCase/
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/
end
......@@ -40,7 +40,7 @@ def test_logs_if_the_template_engine_cannot_be_found
def test_actions_are_turned_into_methods
run_generator
assert_file "app/models/notifier.rb", /def foo/
assert_file "app/models/notifier.rb", /def bar/
assert_file "app/mailers/notifier.rb", /def foo/
assert_file "app/mailers/notifier.rb", /def bar/
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册