-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathsandbox_mode_spec.rb
53 lines (35 loc) · 1.33 KB
/
sandbox_mode_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
51
52
require 'spec_helper'
describe SparkPostRails::DeliveryMethod do
before(:each) do
SparkPostRails.configuration.set_defaults
@delivery_method = SparkPostRails::DeliveryMethod.new
end
context "Sandbox Mode" do
it "handles sandbox mode enabled in the configuration" do
SparkPostRails.configure do |c|
c.sandbox = true
end
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:sandbox]).to eq(true)
end
it "handles sandbox mode enabled on an individual message" do
test_email = Mailer.test_email sparkpost_data: {sandbox: true}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:sandbox]).to eq(true)
end
it "handles the value on an individual message overriding configuration" do
SparkPostRails.configure do |c|
c.sandbox = true
end
test_email = Mailer.test_email sparkpost_data: {sandbox: false}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options].has_key?(:sandbox)).to eq(false)
end
it "handles a default setting of 'false'" do
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options].has_key?(:sandbox)).to eq(false)
end
end
end