mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Updating generators for mailer to reflect changes in API
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class <%= class_name %> < ActionMailer::Base
|
||||
delivers_from "from@example.com"
|
||||
self.defaults = { :from => "from@example.com" }
|
||||
<% for action in actions -%>
|
||||
|
||||
# Subject can be set in your I18n file at config/locales/en.yml
|
||||
@@ -9,7 +9,7 @@ class <%= class_name %> < ActionMailer::Base
|
||||
#
|
||||
def <%= action %>
|
||||
@greeting = "Hi"
|
||||
mail(:to => "to@example.com")
|
||||
mail(:to => "to@example.org")
|
||||
end
|
||||
<% end -%>
|
||||
end
|
||||
@@ -9,7 +9,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase
|
||||
run_generator
|
||||
assert_file "app/mailers/notifier.rb" do |mailer|
|
||||
assert_match /class Notifier < ActionMailer::Base/, mailer
|
||||
assert_match /delivers_from "from@example.com"/, mailer
|
||||
assert_match /self\.defaults\ =\ \{\ :from\ =>\ "from@example\.com"\ \}/, mailer
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,12 +61,12 @@ class MailerGeneratorTest < Rails::Generators::TestCase
|
||||
|
||||
assert_file "app/mailers/notifier.rb" do |mailer|
|
||||
assert_instance_method :foo, mailer do |foo|
|
||||
assert_match /mail\(:to => "to@example.com"\)/, foo
|
||||
assert_match /mail\(:to => "to@example.org"\)/, foo
|
||||
assert_match /@greeting = "Hi"/, foo
|
||||
end
|
||||
|
||||
assert_instance_method :bar, mailer do |bar|
|
||||
assert_match /mail\(:to => "to@example.com"\)/, bar
|
||||
assert_match /mail\(:to => "to@example.org"\)/, bar
|
||||
assert_match /@greeting = "Hi"/, bar
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user