-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathheaders_spec.rb
33 lines (23 loc) · 1.22 KB
/
headers_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'
describe SparkPostRails::DeliveryMethod do
before(:each) do
@delivery_method = SparkPostRails::DeliveryMethod.new
end
context "Headers" do
it "passes appropriate headers through to the API" do
test_email = Mailer.test_email headers: {"Priority" => "urgent", "Sensitivity" => "private"}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:content][:headers]).to eq({"Priority" => "urgent", "Sensitivity" => "private"})
end
it "is compatible with CC functionality" do
test_email = Mailer.test_email cc: "Carl Test <[email protected]>", headers: {"Priority" => "urgent", "Sensitivity" => "private"}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:content][:headers]).to eq({cc: "[email protected]", "Priority" => "urgent", "Sensitivity" => "private"})
end
it "does not pass inappropriate headers through to the API" do
test_email = Mailer.test_email headers: {content_type: "POSTSCRIPT", "Priority" => "urgent", "Sensitivity" => "private"}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:content][:headers]).to eq({"Priority" => "urgent", "Sensitivity" => "private"})
end
end
end