-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from wildbit/fix-message-stream-headers
Set the message stream as a header so we pass it to the API properly
- Loading branch information
Showing
3 changed files
with
31 additions
and
23 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
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 |
---|---|---|
|
@@ -173,15 +173,15 @@ | |
end | ||
|
||
it 'converts plain text messages correctly' do | ||
expect(subject.new(mail_message).run).to eq ({ | ||
expect(subject.new(mail_message).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"TextBody" => "Hello Sheldon!", | ||
"To" => "[email protected]"}) | ||
end | ||
|
||
it 'converts tagged text messages correctly' do | ||
expect(subject.new(tagged_mail_message).run).to eq ({ | ||
expect(subject.new(tagged_mail_message).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"TextBody" => "Hello Sheldon!", | ||
|
@@ -190,22 +190,22 @@ | |
end | ||
|
||
it 'converts plain text messages without body correctly' do | ||
expect(subject.new(mail_message_without_body).run).to eq ({ | ||
expect(subject.new(mail_message_without_body).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"To" => "[email protected]"}) | ||
end | ||
|
||
it 'converts html messages correctly' do | ||
expect(subject.new(mail_html_message).run).to eq ({ | ||
expect(subject.new(mail_html_message).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
"To" => "[email protected]"}) | ||
end | ||
|
||
it 'converts multipart messages correctly' do | ||
expect(subject.new(mail_multipart_message).run).to eq ({ | ||
expect(subject.new(mail_multipart_message).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -214,7 +214,7 @@ | |
end | ||
|
||
it 'converts messages with attachments correctly' do | ||
expect(subject.new(mail_message_with_attachment).run).to eq ({ | ||
expect(subject.new(mail_message_with_attachment).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"Attachments" => [{"Name" => "empty.gif", | ||
|
@@ -225,7 +225,7 @@ | |
end | ||
|
||
it 'converts messages with named addresses correctly' do | ||
expect(subject.new(mail_message_with_named_addresses).run).to eq ({ | ||
expect(subject.new(mail_message_with_named_addresses).run).to eq({ | ||
"From" => "Sheldon <[email protected]>", | ||
"Subject" => "Hello!", | ||
"TextBody" => "Hello Sheldon!", | ||
|
@@ -244,7 +244,7 @@ | |
context 'open tracking' do | ||
context 'setup inside of mail' do | ||
it 'converts open tracking enabled messages correctly' do | ||
expect(subject.new(mail_message_with_open_tracking).run).to eq ({ | ||
expect(subject.new(mail_message_with_open_tracking).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -253,7 +253,7 @@ | |
end | ||
|
||
it 'converts open tracking disabled messages correctly' do | ||
expect(subject.new(mail_message_with_open_tracking_disabled).run).to eq ({ | ||
expect(subject.new(mail_message_with_open_tracking_disabled).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -264,7 +264,7 @@ | |
|
||
context 'setup with tracking variable' do | ||
it 'converts open tracking enabled messages correctly' do | ||
expect(subject.new(mail_message_with_open_tracking_set_variable).run).to eq ({ | ||
expect(subject.new(mail_message_with_open_tracking_set_variable).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -273,7 +273,7 @@ | |
end | ||
|
||
it 'converts open tracking disabled messages correctly' do | ||
expect(subject.new(mail_message_with_open_tracking_disabled_set_variable).run).to eq ({ | ||
expect(subject.new(mail_message_with_open_tracking_disabled_set_variable).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -285,7 +285,7 @@ | |
|
||
context 'link tracking' do | ||
it 'converts html and text link tracking enabled messages correctly' do | ||
expect(subject.new(mail_message_with_link_tracking_all).run).to eq ({ | ||
expect(subject.new(mail_message_with_link_tracking_all).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -294,7 +294,7 @@ | |
end | ||
|
||
it 'converts html only link tracking enabled messages correctly' do | ||
expect(subject.new(mail_message_with_link_tracking_html).run).to eq ({ | ||
expect(subject.new(mail_message_with_link_tracking_html).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -303,7 +303,7 @@ | |
end | ||
|
||
it 'converts text only link tracking enabled messages correctly' do | ||
expect(subject.new(mail_message_with_link_tracking_text).run).to eq ({ | ||
expect(subject.new(mail_message_with_link_tracking_text).run).to eq({ | ||
"From" => "[email protected]", | ||
"Subject" => "Hello!", | ||
"HtmlBody" => "<b>Hello Sheldon!</b>", | ||
|
@@ -377,13 +377,17 @@ | |
|
||
describe 'passing message stream' do | ||
context 'when not set' do | ||
specify { expect(mail_message.to_postmark_hash.keys).not_to include('MessageStream') } | ||
specify { expect(subject.new(mail_message).run).not_to include('MessageStream') } | ||
end | ||
|
||
context 'when set' do | ||
before { mail_message.message_stream = 'weekly-newsletter' } | ||
before do | ||
mail_message.message_stream = 'weekly-newsletter' | ||
end | ||
|
||
specify { expect(mail_message.to_postmark_hash).to include('MessageStream' => 'weekly-newsletter') } | ||
it 'passes message stream to the API call' do | ||
expect(subject.new(mail_message).run).to include('MessageStream' => 'weekly-newsletter') | ||
end | ||
end | ||
end | ||
end |