-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathip_pool_spec.rb
50 lines (35 loc) · 1.35 KB
/
ip_pool_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 "IP Pool" do
it "handles ip_pool set in the configuration" do
SparkPostRails.configure do |c|
c.ip_pool = "default_ip"
end
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:ip_pool]).to eq("default_ip")
end
it "handles ip_pool set on an individual message" do
test_email = Mailer.test_email sparkpost_data: {ip_pool: "message_ip"}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:ip_pool]).to eq("message_ip")
end
it "handles the value on an individual message overriding configuration" do
SparkPostRails.configure do |c|
c.ip_pool = "default_ip"
end
test_email = Mailer.test_email sparkpost_data: {ip_pool: "message_ip"}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:ip_pool]).to eq("message_ip")
end
it "handles a default setting of none" do
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options].has_key?(:ip_pool)).to eq(false)
end
end
end