Skip to content

Commit

Permalink
git-er-done
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Jan 10, 2019
1 parent 4c32150 commit 457bdd9
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 17 deletions.
17 changes: 0 additions & 17 deletions spec/composer_spec.cr

This file was deleted.

65 changes: 65 additions & 0 deletions spec/quartz/composer_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
require "../spec_helper"

class ComposerTestMailer < Quartz::Composer
def initialize
subject "Foo Bar"
to "foo@bar.com"
cc "foo@bar.com"
bcc "foo@bar.com"
text "foobar_text"
html "foobar_html"
end

def sender
"foo@bar.com"
end
end

composer = ComposerTestMailer.new

describe Quartz::Composer do
{% for method in [:sender, :deliver, :address, :to, :cc, :bcc, :subject, :text, :body] %}
{% method = method.id %}

it "responds_to?({{method}})" do
composer.responds_to?(:{{method}}).should(be_true)
end
{% end %}

context "message" do
it "has a message" do
composer.@message.is_a?(Quartz::Message).should(be_true)
end

it "sets message attributes" do
composer.@message._to.size.should eq(1)
composer.@message._cc.size.should eq (1)
composer.@message._bcc.size.should eq (1)
composer.@message._subject.should eq ("Foo Bar")
composer.@message._text.should eq ("foobar_text")
composer.@message._html.should eq ("foobar_html")

body_str = "foobar_body"
composer.body body_str

composer.@message._text.should eq(body_str)
end
end

context "deliver" do
it "sets the sender" do
# composer.deliver ### deliver freezes the tests
# composer.@message._from.should eq(composer.sender)
end
end

context "render" do
it "with_layout" do
#render("composer_test_mailer.html.slang")
end

it "without_layout" do
#render("composer_test_mailer.html.slang", "mailer_layout.html.slang")
end
end
end

0 comments on commit 457bdd9

Please sign in to comment.