-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathreturn_path_spec.rb
50 lines (35 loc) · 1.39 KB
/
return_path_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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'spec_helper'
describe SparkPostRails::DeliveryMethod do
before(:each) do
SparkPostRails.configuration.set_defaults
@delivery_method = SparkPostRails::DeliveryMethod.new
end
context "Return Path" do
it "handles return path set in the configuration" do
SparkPostRails.configure do |c|
c.return_path = "[email protected]"
end
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:return_path]).to eq('[email protected]')
end
it "handles return path on an individual message" do
test_email = Mailer.test_email return_path: "[email protected]"
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:return_path]).to eq('[email protected]')
end
it "handles the value on an individual message overriding configuration" do
SparkPostRails.configure do |c|
c.return_path = "[email protected]"
end
test_email = Mailer.test_email return_path: "[email protected]"
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:return_path]).to eq('[email protected]')
end
it "handles a default setting of none" do
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data.has_key?(:return_path)).to eq(false)
end
end
end