-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathtransactional_spec.rb
50 lines (35 loc) · 1.34 KB
/
transactional_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 "Transactional" do
it "handles transactional flag set in the configuration" do
SparkPostRails.configure do |c|
c.transactional = true
end
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:transactional]).to eq(true)
end
it "handles transactional set on an individual message" do
test_email = Mailer.test_email sparkpost_data: {transactional: true}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:transactional]).to eq(true)
end
it "handles the value on an individual message overriding configuration" do
SparkPostRails.configure do |c|
c.transactional = true
end
test_email = Mailer.test_email sparkpost_data: {transactional: false}
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:transactional]).to eq(false)
end
it "handles unset value" do
test_email = Mailer.test_email
@delivery_method.deliver!(test_email)
expect(@delivery_method.data[:options][:transactional]).to eq(false)
end
end
end