test/fixtures/padrino_app/app.rb in padrino-mailer-0.9.14 vs test/fixtures/padrino_app/app.rb in padrino-mailer-0.9.15
- old
+ new
@@ -1,20 +1,13 @@
ENV['PADRINO_ENV'] = 'test'
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
class PadrinoApp < Padrino::Application
+ register Padrino::Helpers
register Padrino::Mailer
- set :delivery_method, :smtp => {
- :address => "smtp.gmail.com",
- :port => 587,
- :domain => 'your.host.name',
- :user_name => '<username>',
- :password => '<password>',
- :authentication => 'plain',
- :enable_starttls_auto => true
- }
+ set :delivery_method, :test
mailer :sample do
email :birthday do |name, age|
subject "Happy Birthday!"
to 'john@fake.com'
@@ -40,10 +33,20 @@
from 'noreply@custom.com'
locals :name => name
via :test
render 'sample/foo_message'
end
+
+ message :helper do |name|
+ subject "Welcome Helper!"
+ to 'jim@fake.com'
+ from 'noreply@custom.com'
+ locals :name => name
+ via :test
+ render 'sample/helper_message'
+ end
+
end
post "/deliver/inline" do
result = email(:to => "john@apple.com", :from => "joe@smith.com", :subject => "Test Email", :body => "Test Body", :via => :test)
result ? "mail delivered" : 'mail not delivered'
@@ -61,9 +64,15 @@
post "/deliver/custom" do
result = deliver(:sample, :welcome, "Bobby")
result ? "mail delivered" : 'mail not delivered'
end
+
+ post "/deliver/helper" do
+ result = deliver(:sample, :helper, "Jim")
+ result ? "mail delivered" : 'mail not delivered'
+ end
+
end
Padrino.mount("PadrinoApp").to("/")
Padrino.load!
\ No newline at end of file