forked from hanami/mailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delivey Method Implementation (hanami#6)
- Loading branch information
1 parent
aeea788
commit dcd68c6
Showing
9 changed files
with
96 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ gem 'tilt' | |
|
||
gem 'simplecov', require: false | ||
gem 'coveralls', require: false | ||
gem 'mail' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Lotus | ||
module Mailer | ||
# Render mechanism | ||
# | ||
# @since 0.1.0 | ||
module Rendering | ||
|
||
# Render a single template with the specified format. | ||
# | ||
# @return [String] the output of the rendering process. | ||
# | ||
# @since 0.1.0 | ||
def render(format) | ||
templates | ||
@templates[format].render | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require 'mail' | ||
|
||
class InvoiceMailer | ||
include Lotus::Mailer | ||
template :html, 'invoice.html.erb' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'test_helper' | ||
require 'lotus/mailer' | ||
|
||
describe Lotus::Mailer do | ||
describe 'render' do | ||
it 'renders a single template with a given format' do | ||
InvoiceMailer.render(:html).must_include %(<h1>Invoice template</h1>) | ||
LazyMailer.render(:html).must_include %(Hello World) | ||
LazyMailer.render(:haml).must_include %(This is a haml template) | ||
LazyMailer.render(:txt).must_include %(This is a txt template) | ||
end | ||
end | ||
end |