sanitize_email 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +73 -0
- data/.rubocop_rspec.yml +35 -0
- data/.rubocop_todo.yml +21 -0
- data/Appraisals +48 -46
- data/Gemfile +14 -1
- data/Rakefile +24 -22
- data/gemfiles/rails_4_2.gemfile +8 -6
- data/gemfiles/rails_5_0.gemfile +8 -6
- data/gemfiles/rails_5_1.gemfile +8 -6
- data/gemfiles/rails_5_2.gemfile +8 -6
- data/init.rb +2 -1
- data/lib/sanitize_email.rb +23 -22
- data/lib/sanitize_email/bleach.rb +24 -24
- data/lib/sanitize_email/config.rb +23 -15
- data/lib/sanitize_email/deprecation.rb +3 -2
- data/lib/sanitize_email/engine.rb +2 -2
- data/lib/sanitize_email/mail_ext.rb +2 -0
- data/lib/sanitize_email/mail_header_tools.rb +16 -17
- data/lib/sanitize_email/overridden_addresses.rb +52 -52
- data/lib/sanitize_email/railtie.rb +2 -2
- data/lib/sanitize_email/rspec_matchers.rb +17 -16
- data/lib/sanitize_email/test_helpers.rb +10 -12
- data/lib/sanitize_email/version.rb +3 -1
- data/sanitize_email.gemspec +34 -32
- data/spec/sanitize_email_spec.rb +476 -480
- data/spec/spec_helper.rb +11 -10
- metadata +42 -38
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
|
2
4
|
# Released under the MIT license
|
3
5
|
|
4
6
|
module SanitizeEmail
|
5
7
|
# For Rails 3.0, which didn't yet support Engines
|
6
8
|
class Railtie < ::Rails::Railtie
|
7
|
-
|
8
9
|
config.after_initialize do
|
9
10
|
ActionMailer::Base.register_interceptor(SanitizeEmail::Bleach)
|
10
11
|
end
|
11
|
-
|
12
12
|
end
|
13
13
|
end
|
@@ -1,47 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
|
2
4
|
# Released under the MIT license
|
3
5
|
# Note: the RspecMatchers are composed matchers:
|
4
6
|
# See: http://www.relishapp.com/rspec/rspec-expectations/v/3-5/docs/composing-matchers
|
5
7
|
|
6
|
-
require
|
8
|
+
require 'sanitize_email/mail_ext'
|
7
9
|
|
8
10
|
module SanitizeEmail
|
9
11
|
# Provides matchers that can be used in
|
10
12
|
# Rspec tests to assert the behavior of email
|
11
13
|
module RspecMatchers
|
12
|
-
[
|
14
|
+
%i[from to cc bcc subject reply_to].each do |attribute|
|
13
15
|
RSpec::Matchers.define "have_#{attribute}" do |matcher|
|
14
16
|
match do |actual|
|
15
17
|
@actual = actual.send(attribute)
|
16
|
-
@actual = @actual.join(
|
18
|
+
@actual = @actual.join(', ') if @actual.respond_to?(:join)
|
17
19
|
expect(@actual).to match(matcher)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
[
|
24
|
+
%i[from to cc bcc subject reply_to].each do |attribute|
|
23
25
|
RSpec::Matchers.define "match_#{attribute}" do |matcher|
|
24
26
|
match do |actual|
|
25
27
|
@actual = actual.send(attribute)
|
26
|
-
@actual = @actual.join(
|
28
|
+
@actual = @actual.join(', ') if @actual.respond_to?(:join)
|
27
29
|
expect(@actual).to match(matcher)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
|
-
[
|
34
|
+
%i[from to cc bcc subject reply_to].each do |attribute|
|
33
35
|
RSpec::Matchers.define "be_#{attribute}" do |matcher|
|
34
36
|
match do |actual|
|
35
37
|
@actual = actual.send(attribute)
|
36
|
-
@actual = @actual.join(
|
38
|
+
@actual = @actual.join(', ') if @actual.respond_to?(:join)
|
37
39
|
expect(@actual).to be(matcher)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
|
-
RSpec::Matchers.define
|
44
|
+
RSpec::Matchers.define 'have_to_username' do |matcher|
|
43
45
|
def get_to_username(email_message)
|
44
|
-
username_header = email_message.header[
|
46
|
+
username_header = email_message.header['X-Sanitize-Email-To']
|
45
47
|
return username_header unless username_header.is_a?(Mail::Field)
|
46
48
|
email_message.header.fields[3].value
|
47
49
|
end
|
@@ -51,9 +53,9 @@ module SanitizeEmail
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
54
|
-
RSpec::Matchers.define
|
56
|
+
RSpec::Matchers.define 'have_cc_username' do |matcher|
|
55
57
|
def get_cc_username(email_message)
|
56
|
-
username_header = email_message.header[
|
58
|
+
username_header = email_message.header['X-Sanitize-Email-Cc']
|
57
59
|
return username_header unless username_header.is_a?(Mail::Field)
|
58
60
|
email_message.header.fields[3].value
|
59
61
|
end
|
@@ -64,13 +66,13 @@ module SanitizeEmail
|
|
64
66
|
end
|
65
67
|
|
66
68
|
# Cribbed from email_spec gem
|
67
|
-
RSpec::Matchers.define
|
69
|
+
RSpec::Matchers.define 'have_body_text' do |matcher|
|
68
70
|
def get_fuzzy_body(email_message)
|
69
|
-
email_message.default_part_body.to_s.gsub(/\s+/,
|
71
|
+
email_message.default_part_body.to_s.gsub(/\s+/, ' ')
|
70
72
|
end
|
71
73
|
|
72
74
|
def get_fuzzy_matcher(to_fuzz)
|
73
|
-
to_fuzz.gsub(/\s+/,
|
75
|
+
to_fuzz.gsub(/\s+/, ' ')
|
74
76
|
end
|
75
77
|
match do |actual|
|
76
78
|
@actual = get_fuzzy_body(actual)
|
@@ -80,13 +82,12 @@ module SanitizeEmail
|
|
80
82
|
end
|
81
83
|
|
82
84
|
# Cribbed from email_spec gem
|
83
|
-
RSpec::Matchers.define
|
85
|
+
RSpec::Matchers.define 'have_header' do |name, matcher|
|
84
86
|
match do |actual|
|
85
87
|
@actual = actual.header[name]
|
86
88
|
@actual = @actual.value unless @actual.nil?
|
87
89
|
expect(@actual).to match(matcher)
|
88
90
|
end
|
89
91
|
end
|
90
|
-
|
91
92
|
end
|
92
93
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
|
2
4
|
# Released under the MIT license
|
3
5
|
# Note: the RspecMatchers no longer use these methods. Instead they are composed matchers:
|
@@ -6,7 +8,6 @@
|
|
6
8
|
module SanitizeEmail
|
7
9
|
# Helpers for test-unit
|
8
10
|
module TestHelpers
|
9
|
-
|
10
11
|
# Error raised when unable to match an expected part of email in order to fail the test
|
11
12
|
class UnexpectedMailType < StandardError; end
|
12
13
|
|
@@ -15,20 +16,18 @@ module SanitizeEmail
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def string_matching(matcher, part, attribute)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
raise UnexpectedMailType, "Cannot match #{matcher} for #{part}"
|
26
|
-
end
|
19
|
+
# Can we match a regex against it?
|
20
|
+
raise UnexpectedMailType, "Cannot match #{matcher} for #{part}" unless attribute.respond_to?(:=~)
|
21
|
+
attribute =~ if matcher.is_a?(Regexp)
|
22
|
+
matcher
|
23
|
+
else
|
24
|
+
Regexp.new(Regexp.escape(matcher))
|
25
|
+
end
|
27
26
|
end
|
28
27
|
|
29
28
|
# Normalize arrays to strings
|
30
29
|
def array_matching(matcher, part, attribute)
|
31
|
-
attribute = attribute.join(
|
30
|
+
attribute = attribute.join(', ') if attribute.respond_to?(:join)
|
32
31
|
string_matching(matcher, part, attribute)
|
33
32
|
end
|
34
33
|
|
@@ -39,6 +38,5 @@ module SanitizeEmail
|
|
39
38
|
def email_attribute_matching(matcher, part, attribute)
|
40
39
|
array_matching(matcher, part, attribute)
|
41
40
|
end
|
42
|
-
|
43
41
|
end
|
44
42
|
end
|
data/sanitize_email.gemspec
CHANGED
@@ -1,47 +1,49 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require File.expand_path('lib/sanitize_email/version', __dir__)
|
3
5
|
|
4
6
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
7
|
+
s.name = 'sanitize_email'
|
6
8
|
s.version = SanitizeEmail::VERSION
|
7
9
|
|
8
|
-
s.authors = [
|
9
|
-
s.summary =
|
10
|
-
s.description =
|
11
|
-
|
12
|
-
In Rails, Sinatra, et al, or simply the mail gem: Aids in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses.
|
13
|
-
|
14
|
-
s.email = [
|
10
|
+
s.authors = ['Peter Boling', 'John Trupiano', 'George Anderson']
|
11
|
+
s.summary = 'Email Condom for your Ruby Server'
|
12
|
+
s.description = <<~DESCRIPTION
|
13
|
+
Email Condom for your Ruby Server.
|
14
|
+
In Rails, Sinatra, et al, or simply the mail gem: Aids in development, testing, qa, and production troubleshooting of email issues without worrying that emails will get sent to actual live addresses.
|
15
|
+
DESCRIPTION
|
16
|
+
s.email = ['peter.boling@gmail.com']
|
15
17
|
s.extra_rdoc_files = [
|
16
|
-
|
17
|
-
|
18
|
-
|
18
|
+
'CHANGELOG.md',
|
19
|
+
'LICENSE',
|
20
|
+
'README.md',
|
19
21
|
]
|
20
|
-
s.files = `git ls-files`.split(
|
21
|
-
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
22
|
+
s.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
23
|
+
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
22
24
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
23
|
-
s.homepage =
|
24
|
-
s.licenses = [
|
25
|
-
s.
|
26
|
-
s.require_paths = ["lib"]
|
25
|
+
s.homepage = 'http://github.com/pboling/sanitize_email'
|
26
|
+
s.licenses = ['MIT']
|
27
|
+
s.require_paths = ['lib']
|
27
28
|
s.platform = Gem::Platform::RUBY
|
29
|
+
s.required_ruby_version = '>= 2.3.0'
|
28
30
|
|
29
31
|
# Runtime Dependencies
|
30
32
|
# A project wanting to use this gem's engine/railtie will be expected to have already loaded the rails/railtie gem.
|
31
|
-
#s.add_dependency "railties", ">= 3.2"
|
33
|
+
# s.add_dependency "railties", ">= 3.2"
|
32
34
|
# to replace the cattr_accessor method we lost when removing rails from run time dependencies
|
33
|
-
#s.add_runtime_dependency("facets", ["> 0"])
|
35
|
+
# s.add_runtime_dependency("facets", ["> 0"])
|
34
36
|
|
35
37
|
# Development Dependencies
|
36
|
-
s.add_development_dependency
|
37
|
-
s.add_development_dependency(
|
38
|
-
s.add_development_dependency
|
39
|
-
s.add_development_dependency(
|
40
|
-
s.add_development_dependency(
|
41
|
-
s.add_development_dependency(
|
42
|
-
s.add_development_dependency(
|
43
|
-
s.add_development_dependency(
|
44
|
-
s.add_development_dependency(
|
45
|
-
s.add_development_dependency(
|
46
|
-
s.add_development_dependency(
|
38
|
+
s.add_development_dependency('actionmailer', ['>= 3'])
|
39
|
+
s.add_development_dependency('appraisal')
|
40
|
+
s.add_development_dependency 'bundler'
|
41
|
+
s.add_development_dependency('byebug', ['>= 0'])
|
42
|
+
s.add_development_dependency('coveralls')
|
43
|
+
s.add_development_dependency('mail', ['>= 0'])
|
44
|
+
s.add_development_dependency('rails', ['>= 3.2', '< 6'])
|
45
|
+
s.add_development_dependency('rake', ['>= 12'])
|
46
|
+
s.add_development_dependency('rdoc', ['>= 3.12'])
|
47
|
+
s.add_development_dependency('rspec', ['>= 3'])
|
48
|
+
s.add_development_dependency('wwtd')
|
47
49
|
end
|
data/spec/sanitize_email_spec.rb
CHANGED
@@ -1,34 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
|
2
4
|
# Released under the MIT license
|
3
|
-
require
|
5
|
+
require 'spec_helper'
|
4
6
|
|
5
7
|
describe SanitizeEmail do
|
6
8
|
DEFAULT_TEST_CONFIG = {
|
7
|
-
sanitized_cc
|
8
|
-
sanitized_bcc
|
9
|
-
use_actual_email_prepended_to_subject
|
10
|
-
use_actual_environment_prepended_to_subject
|
11
|
-
use_actual_email_as_sanitized_user_name
|
9
|
+
:sanitized_cc => 'cc@sanitize_email.org',
|
10
|
+
:sanitized_bcc => 'bcc@sanitize_email.org',
|
11
|
+
:use_actual_email_prepended_to_subject => false,
|
12
|
+
:use_actual_environment_prepended_to_subject => false,
|
13
|
+
:use_actual_email_as_sanitized_user_name => false,
|
12
14
|
}.freeze
|
13
15
|
|
14
|
-
before(:all) do
|
15
|
-
SanitizeEmail::Deprecation.deprecate_in_silence = true
|
16
|
-
end
|
17
|
-
|
18
16
|
# Cleanup, so tests don't bleed
|
19
|
-
after
|
17
|
+
after do
|
20
18
|
SanitizeEmail::Config.config = SanitizeEmail::Config::DEFAULTS
|
21
|
-
|
19
|
+
described_class.force_sanitize = nil
|
22
20
|
Mail.class_variable_get(:@@delivery_interceptors).pop
|
23
21
|
end
|
24
22
|
|
25
|
-
def sanitize_spec_dryer(rails_env =
|
26
|
-
logger = Logger.new($stdout).tap do |
|
27
|
-
|
23
|
+
def sanitize_spec_dryer(rails_env = 'test')
|
24
|
+
logger = Logger.new($stdout).tap do |logsy|
|
25
|
+
logsy.level = 5 # Unknown (make it silent!)
|
28
26
|
end
|
29
27
|
|
30
28
|
Mail.defaults do
|
31
|
-
delivery_method :logger, logger
|
29
|
+
delivery_method :logger, :logger => logger, :severity => :info
|
32
30
|
end
|
33
31
|
SanitizeEmail::Config.instance_variable_set(
|
34
32
|
:@config,
|
@@ -40,8 +38,13 @@ describe SanitizeEmail do
|
|
40
38
|
def configure_sanitize_email(sanitize_hash = {})
|
41
39
|
options = DEFAULT_TEST_CONFIG.merge(sanitize_hash).dup
|
42
40
|
unless sanitize_hash.key?(:sanitized_recipients)
|
43
|
-
options.reverse_merge!(sanitized_to
|
41
|
+
options.reverse_merge!(:sanitized_to => 'to@sanitize_email.org')
|
44
42
|
end
|
43
|
+
configure_from_options(options)
|
44
|
+
Mail.register_interceptor(SanitizeEmail::Bleach)
|
45
|
+
end
|
46
|
+
|
47
|
+
def configure_from_options(options)
|
45
48
|
SanitizeEmail::Config.configure do |config|
|
46
49
|
config[:engage] = options[:engage]
|
47
50
|
config[:environment] = options[:environment]
|
@@ -49,39 +52,29 @@ describe SanitizeEmail do
|
|
49
52
|
config[:sanitized_to] = options[:sanitized_to]
|
50
53
|
config[:sanitized_cc] = options[:sanitized_cc]
|
51
54
|
config[:sanitized_bcc] = options[:sanitized_bcc]
|
52
|
-
config[:use_actual_email_prepended_to_subject] =
|
53
|
-
|
54
|
-
config[:
|
55
|
-
options[:use_actual_environment_prepended_to_subject]
|
56
|
-
config[:use_actual_email_as_sanitized_user_name] =
|
57
|
-
options[:use_actual_email_as_sanitized_user_name]
|
55
|
+
config[:use_actual_email_prepended_to_subject] = options[:use_actual_email_prepended_to_subject]
|
56
|
+
config[:use_actual_environment_prepended_to_subject] = options[:use_actual_environment_prepended_to_subject]
|
57
|
+
config[:use_actual_email_as_sanitized_user_name] = options[:use_actual_email_as_sanitized_user_name]
|
58
58
|
|
59
59
|
# For testing *deprecated* configuration options:
|
60
|
-
if options[:local_environments]
|
61
|
-
|
62
|
-
|
63
|
-
if options[:sanitized_recipients]
|
64
|
-
config[:sanitized_recipients] = options[:sanitized_recipients]
|
65
|
-
end
|
66
|
-
unless options[:force_sanitize].nil?
|
67
|
-
config[:force_sanitize] = options[:force_sanitize]
|
68
|
-
end
|
60
|
+
config[:local_environments] = options[:local_environments] if options[:local_environments]
|
61
|
+
config[:sanitized_recipients] = options[:sanitized_recipients] if options[:sanitized_recipients]
|
62
|
+
config[:force_sanitize] = options[:force_sanitize] unless options[:force_sanitize].nil?
|
69
63
|
end
|
70
|
-
Mail.register_interceptor(SanitizeEmail::Bleach)
|
71
64
|
end
|
72
65
|
|
73
66
|
def funky_config
|
74
67
|
SanitizeEmail::Config.configure do |config|
|
75
68
|
config[:sanitized_to] =
|
76
|
-
%w
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
69
|
+
%w[
|
70
|
+
funky@sanitize_email.org
|
71
|
+
yummy@sanitize_email.org
|
72
|
+
same@example.org
|
73
|
+
]
|
81
74
|
config[:sanitized_cc] = nil
|
82
75
|
config[:sanitized_bcc] = nil
|
83
76
|
# logic to turn sanitize_email on and off goes in this Proc:
|
84
|
-
config[:activation_proc] = proc { Rails.env !=
|
77
|
+
config[:activation_proc] = proc { Rails.env != 'production' }
|
85
78
|
config[:use_actual_email_prepended_to_subject] = true
|
86
79
|
config[:use_actual_environment_prepended_to_subject] = true
|
87
80
|
config[:use_actual_email_as_sanitized_user_name] = false
|
@@ -115,502 +108,503 @@ describe SanitizeEmail do
|
|
115
108
|
|
116
109
|
def mail_delivery_frozen_strings
|
117
110
|
@email_message = Mail.deliver do
|
118
|
-
from
|
119
|
-
to
|
120
|
-
subject
|
121
|
-
body
|
111
|
+
from 'from@example.org'
|
112
|
+
to 'to@example.org'
|
113
|
+
subject 'original subject'
|
114
|
+
body 'funky fresh'
|
122
115
|
end
|
123
116
|
end
|
124
117
|
|
125
118
|
def mail_delivery_hot_mess
|
126
119
|
@email_message = Mail.deliver do
|
127
|
-
from
|
128
|
-
to %w
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
cc
|
136
|
-
bcc
|
137
|
-
reply_to
|
138
|
-
subject
|
139
|
-
body
|
120
|
+
from 'same@example.org'
|
121
|
+
to %w[
|
122
|
+
same@example.org
|
123
|
+
same@example.org
|
124
|
+
same@example.org
|
125
|
+
same@example.org
|
126
|
+
same@example.org
|
127
|
+
]
|
128
|
+
cc 'same@example.org'
|
129
|
+
bcc 'same@example.org'
|
130
|
+
reply_to 'same@example.org'
|
131
|
+
subject 'original subject'
|
132
|
+
body 'funky fresh'
|
140
133
|
end
|
141
134
|
end
|
142
135
|
|
143
136
|
def mail_delivery
|
144
137
|
@email_message = Mail.deliver do
|
145
|
-
from
|
146
|
-
to
|
147
|
-
cc
|
148
|
-
bcc
|
149
|
-
reply_to
|
150
|
-
subject
|
151
|
-
body
|
138
|
+
from 'from@example.org'
|
139
|
+
to 'to@example.org'
|
140
|
+
cc 'cc@example.org'
|
141
|
+
bcc 'bcc@example.org'
|
142
|
+
reply_to 'reply_to@example.org'
|
143
|
+
subject 'original subject'
|
144
|
+
body 'funky fresh'
|
152
145
|
end
|
153
146
|
end
|
154
147
|
|
155
148
|
def mail_delivery_multiple_recipients
|
156
149
|
@email_message = Mail.deliver do
|
157
|
-
from
|
158
|
-
to %w
|
159
|
-
cc %w
|
160
|
-
bcc %w
|
161
|
-
reply_to
|
162
|
-
subject
|
163
|
-
body
|
150
|
+
from 'from@example.org'
|
151
|
+
to %w[to1@example.org to2@example.org to3@example.org]
|
152
|
+
cc %w[cc1@example.org cc2@example.org cc3@example.org]
|
153
|
+
bcc %w[bcc1@example.org bcc2@example.org bcc3@example.org]
|
154
|
+
reply_to 'reply_to@example.org'
|
155
|
+
subject 'original subject'
|
156
|
+
body 'funky fresh'
|
164
157
|
end
|
165
158
|
end
|
166
159
|
|
167
|
-
before
|
160
|
+
before do
|
161
|
+
SanitizeEmail::Deprecation.deprecate_in_silence = true
|
168
162
|
sanitize_spec_dryer
|
169
163
|
end
|
170
164
|
|
171
|
-
context
|
172
|
-
context
|
173
|
-
before
|
165
|
+
context 'module methods' do
|
166
|
+
context 'unsanitary' do
|
167
|
+
before do
|
174
168
|
configure_sanitize_email
|
175
169
|
unsanitary_mail_delivery
|
176
170
|
end
|
177
|
-
it
|
178
|
-
expect(@email_message).to have_from(
|
179
|
-
expect(@email_message).to have_reply_to(
|
180
|
-
expect(@email_message).to have_body_text(
|
171
|
+
it 'does not alter non-sanitized attributes' do
|
172
|
+
expect(@email_message).to have_from('from@example.org')
|
173
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
174
|
+
expect(@email_message).to have_body_text('funky fresh')
|
181
175
|
end
|
182
|
-
it
|
176
|
+
it 'does not prepend overrides' do
|
183
177
|
expect(@email_message).not_to have_to_username(
|
184
|
-
|
178
|
+
'to at sanitize_email.org'
|
185
179
|
)
|
186
180
|
expect(@email_message).not_to have_subject(
|
187
|
-
|
181
|
+
'(to at sanitize_email.org)'
|
188
182
|
)
|
189
183
|
end
|
190
|
-
it
|
191
|
-
expect(@email_message).to have_from(
|
192
|
-
expect(@email_message).to have_reply_to(
|
193
|
-
expect(@email_message).to have_from(
|
194
|
-
expect(@email_message).to have_to(
|
195
|
-
expect(@email_message).not_to have_to_username(
|
196
|
-
expect(@email_message).to have_cc(
|
197
|
-
expect(@email_message).to have_bcc(
|
198
|
-
expect(@email_message).to have_subject(
|
199
|
-
expect(@email_message).to have_body_text(
|
184
|
+
it 'alters nothing' do
|
185
|
+
expect(@email_message).to have_from('from@example.org')
|
186
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
187
|
+
expect(@email_message).to have_from('from@example.org')
|
188
|
+
expect(@email_message).to have_to('to@example.org')
|
189
|
+
expect(@email_message).not_to have_to_username('to at')
|
190
|
+
expect(@email_message).to have_cc('cc@example.org')
|
191
|
+
expect(@email_message).to have_bcc('bcc@example.org')
|
192
|
+
expect(@email_message).to have_subject('original subject')
|
193
|
+
expect(@email_message).to have_body_text('funky fresh')
|
200
194
|
end
|
201
195
|
end
|
202
196
|
|
203
|
-
context
|
204
|
-
before
|
197
|
+
context 'sanitary' do
|
198
|
+
before do
|
205
199
|
configure_sanitize_email
|
206
200
|
sanitary_mail_delivery
|
207
201
|
end
|
208
|
-
it
|
209
|
-
expect(@email_message).to have_from(
|
210
|
-
expect(@email_message).to have_reply_to(
|
211
|
-
expect(@email_message).to have_body_text(
|
202
|
+
it 'does not alter non-sanitized attributes' do
|
203
|
+
expect(@email_message).to have_from('from@example.org')
|
204
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
205
|
+
expect(@email_message).to have_body_text('funky fresh')
|
212
206
|
end
|
213
|
-
it
|
207
|
+
it 'does not prepend overrides' do
|
214
208
|
expect(@email_message).not_to have_to_username(
|
215
|
-
|
209
|
+
'to at sanitize_email.org'
|
216
210
|
)
|
217
211
|
expect(@email_message).not_to have_subject(
|
218
|
-
|
212
|
+
'(to at sanitize_email.org)'
|
219
213
|
)
|
220
214
|
end
|
221
|
-
it
|
222
|
-
expect(@email_message).to have_to(
|
223
|
-
expect(@email_message).to have_cc(
|
224
|
-
expect(@email_message).to have_bcc(
|
215
|
+
it 'overrides' do
|
216
|
+
expect(@email_message).to have_to('to@sanitize_email.org')
|
217
|
+
expect(@email_message).to have_cc('cc@sanitize_email.org')
|
218
|
+
expect(@email_message).to have_bcc('bcc@sanitize_email.org')
|
225
219
|
end
|
226
|
-
it
|
220
|
+
it 'sets headers' do
|
227
221
|
expect(@email_message).to have_header(
|
228
|
-
|
229
|
-
|
222
|
+
'X-Sanitize-Email-To',
|
223
|
+
'to@example.org'
|
230
224
|
)
|
231
225
|
expect(@email_message).to have_header(
|
232
|
-
|
233
|
-
|
226
|
+
'X-Sanitize-Email-Cc',
|
227
|
+
'cc@example.org'
|
234
228
|
)
|
235
229
|
expect(@email_message).not_to have_header(
|
236
|
-
|
237
|
-
|
230
|
+
'X-Sanitize-Email-Bcc',
|
231
|
+
'bcc@sanitize_email.org'
|
238
232
|
)
|
239
233
|
end
|
240
|
-
it
|
234
|
+
it 'does not prepend originals by default' do
|
241
235
|
expect(@email_message).not_to have_to_username(
|
242
|
-
|
236
|
+
'to at example.org <to@sanitize_email.org>'
|
243
237
|
)
|
244
238
|
expect(@email_message).not_to have_subject(
|
245
|
-
|
239
|
+
'(to at example.org) original subject'
|
246
240
|
)
|
247
241
|
end
|
248
242
|
end
|
249
243
|
|
250
|
-
context
|
251
|
-
before
|
244
|
+
context 'sanitary with multiple recipients' do
|
245
|
+
before do
|
252
246
|
configure_sanitize_email
|
253
247
|
sanitary_mail_delivery_multiple_recipients
|
254
248
|
end
|
255
|
-
it
|
256
|
-
expect(@email_message).to have_from(
|
257
|
-
expect(@email_message).to have_reply_to(
|
258
|
-
expect(@email_message).to have_body_text(
|
249
|
+
it 'does not alter non-sanitized attributes' do
|
250
|
+
expect(@email_message).to have_from('from@example.org')
|
251
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
252
|
+
expect(@email_message).to have_body_text('funky fresh')
|
259
253
|
end
|
260
|
-
it
|
254
|
+
it 'does not prepend overrides' do
|
261
255
|
expect(@email_message).not_to have_to_username(
|
262
|
-
|
256
|
+
'to at sanitize_email.org'
|
263
257
|
)
|
264
|
-
expect(@email_message).not_to have_subject(
|
258
|
+
expect(@email_message).not_to have_subject('(to at sanitize_email.org)')
|
265
259
|
end
|
266
|
-
it
|
267
|
-
expect(@email_message).to have_to(
|
268
|
-
expect(@email_message).to have_cc(
|
269
|
-
expect(@email_message).to have_bcc(
|
260
|
+
it 'overrides' do
|
261
|
+
expect(@email_message).to have_to('to@sanitize_email.org')
|
262
|
+
expect(@email_message).to have_cc('cc@sanitize_email.org')
|
263
|
+
expect(@email_message).to have_bcc('bcc@sanitize_email.org')
|
270
264
|
end
|
271
|
-
it
|
265
|
+
it 'sets headers for sanitized :to recipients' do
|
272
266
|
expect(@email_message).to have_header(
|
273
|
-
|
274
|
-
|
267
|
+
'X-Sanitize-Email-To',
|
268
|
+
'to1@example.org'
|
275
269
|
)
|
276
270
|
expect(@email_message).not_to have_header(
|
277
|
-
|
278
|
-
|
271
|
+
'X-Sanitize-Email-To-0',
|
272
|
+
'to1@example.org'
|
279
273
|
)
|
280
274
|
expect(@email_message).not_to have_header(
|
281
|
-
|
282
|
-
|
275
|
+
'X-Sanitize-Email-To-1',
|
276
|
+
'to1@example.org'
|
283
277
|
)
|
284
278
|
expect(@email_message).to have_header(
|
285
|
-
|
286
|
-
|
279
|
+
'X-Sanitize-Email-To-2',
|
280
|
+
'to2@example.org'
|
287
281
|
)
|
288
282
|
expect(@email_message).to have_header(
|
289
|
-
|
290
|
-
|
283
|
+
'X-Sanitize-Email-To-3',
|
284
|
+
'to3@example.org'
|
291
285
|
)
|
292
286
|
end
|
293
|
-
it
|
287
|
+
it 'sets headers for sanitized :cc recipients' do
|
294
288
|
expect(@email_message).to have_header(
|
295
|
-
|
296
|
-
|
289
|
+
'X-Sanitize-Email-Cc',
|
290
|
+
'cc1@example.org'
|
297
291
|
)
|
298
292
|
expect(@email_message).not_to have_header(
|
299
|
-
|
300
|
-
|
293
|
+
'X-Sanitize-Email-Cc-0',
|
294
|
+
'cc1@example.org'
|
301
295
|
)
|
302
296
|
expect(@email_message).not_to have_header(
|
303
|
-
|
304
|
-
|
297
|
+
'X-Sanitize-Email-Cc-1',
|
298
|
+
'cc1@example.org'
|
305
299
|
)
|
306
300
|
expect(@email_message).to have_header(
|
307
|
-
|
308
|
-
|
301
|
+
'X-Sanitize-Email-Cc-2',
|
302
|
+
'cc2@example.org'
|
309
303
|
)
|
310
304
|
expect(@email_message).to have_header(
|
311
|
-
|
312
|
-
|
305
|
+
'X-Sanitize-Email-Cc-3',
|
306
|
+
'cc3@example.org'
|
313
307
|
)
|
314
308
|
end
|
315
|
-
it
|
309
|
+
it 'does not set headers for sanitized :bcc recipients' do
|
316
310
|
expect(@email_message).not_to have_header(
|
317
|
-
|
318
|
-
|
311
|
+
'X-Sanitize-Email-Bcc',
|
312
|
+
'bcc1@sanitize_email.org'
|
319
313
|
)
|
320
314
|
expect(@email_message).not_to have_header(
|
321
|
-
|
322
|
-
|
315
|
+
'X-Sanitize-Email-Bcc-0',
|
316
|
+
'bcc1@sanitize_email.org'
|
323
317
|
)
|
324
318
|
expect(@email_message).not_to have_header(
|
325
|
-
|
326
|
-
|
319
|
+
'X-Sanitize-Email-Bcc-1',
|
320
|
+
'bcc1@sanitize_email.org'
|
327
321
|
)
|
328
322
|
expect(@email_message).not_to have_header(
|
329
|
-
|
330
|
-
|
323
|
+
'X-Sanitize-Email-Bcc-2',
|
324
|
+
'bcc2@sanitize_email.org'
|
331
325
|
)
|
332
326
|
expect(@email_message).not_to have_header(
|
333
|
-
|
334
|
-
|
327
|
+
'X-Sanitize-Email-Bcc-3',
|
328
|
+
'bcc3@sanitize_email.org'
|
335
329
|
)
|
336
330
|
end
|
337
|
-
it
|
331
|
+
it 'does not prepend originals by default' do
|
338
332
|
expect(@email_message).not_to have_to_username(
|
339
|
-
|
333
|
+
'to at example.org <to@sanitize_email.org>'
|
340
334
|
)
|
341
335
|
expect(@email_message).not_to have_subject(
|
342
|
-
|
336
|
+
'(to at example.org) original subject'
|
343
337
|
)
|
344
338
|
end
|
345
339
|
end
|
346
340
|
|
347
|
-
context
|
348
|
-
before
|
341
|
+
context 'sanitary with funky config' do
|
342
|
+
before do
|
349
343
|
funky_config
|
350
|
-
|
344
|
+
described_class.force_sanitize = true
|
351
345
|
mail_delivery
|
352
346
|
end
|
353
|
-
it
|
347
|
+
it 'original to is prepended to subject' do
|
354
348
|
regex = /\(to at example.org\).*original subject/
|
355
349
|
expect(@email_message).to have_subject(regex)
|
356
350
|
end
|
357
|
-
it
|
351
|
+
it 'original to is only prepended once to subject' do
|
358
352
|
regex = /\(to at example.org\).*\(to at example.org\).*original subject/
|
359
353
|
expect(@email_message).not_to have_subject(regex)
|
360
354
|
end
|
361
|
-
it
|
362
|
-
expect(@email_message).to have_from(
|
363
|
-
expect(@email_message).to have_reply_to(
|
364
|
-
expect(@email_message).to have_body_text(
|
355
|
+
it 'does not alter non-sanitized attributes' do
|
356
|
+
expect(@email_message).to have_from('from@example.org')
|
357
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
358
|
+
expect(@email_message).to have_body_text('funky fresh')
|
365
359
|
end
|
366
|
-
it
|
360
|
+
it 'does not prepend overrides' do
|
367
361
|
expect(@email_message).not_to have_to_username(
|
368
|
-
|
362
|
+
'to at sanitize_email.org'
|
369
363
|
)
|
370
364
|
regex = /.*\(to at sanitize_email.org\).*/
|
371
365
|
expect(@email_message).not_to have_subject(regex)
|
372
366
|
end
|
373
|
-
it
|
374
|
-
expect(@email_message).to have_to(
|
367
|
+
it 'overrides where original recipients were not nil' do
|
368
|
+
expect(@email_message).to have_to('funky@sanitize_email.org')
|
375
369
|
end
|
376
|
-
it
|
377
|
-
expect(@email_message).not_to have_cc(
|
378
|
-
expect(@email_message).not_to have_bcc(
|
370
|
+
it 'does not override where original recipients were nil' do
|
371
|
+
expect(@email_message).not_to have_cc('cc@sanitize_email.org')
|
372
|
+
expect(@email_message).not_to have_bcc('bcc@sanitize_email.org')
|
379
373
|
end
|
380
|
-
it
|
374
|
+
it 'sets headers of originals' do
|
381
375
|
expect(@email_message).to have_header(
|
382
|
-
|
383
|
-
|
376
|
+
'X-Sanitize-Email-To',
|
377
|
+
'to@example.org'
|
384
378
|
)
|
385
379
|
expect(@email_message).to have_header(
|
386
|
-
|
387
|
-
|
380
|
+
'X-Sanitize-Email-Cc',
|
381
|
+
'cc@example.org'
|
388
382
|
)
|
389
383
|
end
|
390
|
-
it
|
384
|
+
it 'does not set headers of bcc' do
|
391
385
|
expect(@email_message).not_to have_header(
|
392
|
-
|
393
|
-
|
386
|
+
'X-Sanitize-Email-Bcc',
|
387
|
+
'bcc@sanitize_email.org'
|
394
388
|
)
|
395
389
|
end
|
396
|
-
it
|
390
|
+
it 'does not set headers of overrides' do
|
397
391
|
expect(@email_message).not_to have_header(
|
398
|
-
|
399
|
-
|
392
|
+
'X-Sanitize-Email-To',
|
393
|
+
'funky@sanitize_email.org'
|
400
394
|
)
|
401
395
|
expect(@email_message).not_to have_header(
|
402
|
-
|
403
|
-
|
396
|
+
'X-Sanitize-Email-Cc',
|
397
|
+
'cc@sanitize_email.org'
|
404
398
|
)
|
405
399
|
expect(@email_message).not_to have_header(
|
406
|
-
|
407
|
-
|
400
|
+
'X-Sanitize-Email-Bcc',
|
401
|
+
'bcc@sanitize_email.org'
|
408
402
|
)
|
409
|
-
#puts "email headers:\n#{@email_message.header}"
|
403
|
+
# puts "email headers:\n#{@email_message.header}"
|
410
404
|
end
|
411
|
-
it
|
405
|
+
it 'does not prepend originals by default' do
|
412
406
|
expect(@email_message).not_to have_to_username(
|
413
|
-
|
407
|
+
'to at example.org <to@sanitize_email.org>'
|
414
408
|
)
|
415
409
|
expect(@email_message).not_to have_subject(
|
416
|
-
|
410
|
+
'(to at example.org) original subject'
|
417
411
|
)
|
418
412
|
end
|
419
413
|
end
|
420
414
|
|
421
|
-
context
|
422
|
-
before
|
415
|
+
context 'sanitary with funky config and hot mess delivery' do
|
416
|
+
before do
|
423
417
|
funky_config
|
424
|
-
|
418
|
+
described_class.force_sanitize = true
|
425
419
|
mail_delivery_hot_mess
|
426
420
|
end
|
427
|
-
it
|
421
|
+
it 'original to is prepended to subject' do
|
428
422
|
regex = /\(same at example.org\).*original subject/
|
429
423
|
expect(@email_message).to match_subject(regex)
|
430
424
|
end
|
431
|
-
it
|
425
|
+
it 'original to is only prepended once to subject' do
|
432
426
|
regex = /\(same at example.org\).*\(same at example.org\).*original subject/
|
433
427
|
expect(@email_message).not_to match_subject(regex)
|
434
428
|
end
|
435
|
-
it
|
436
|
-
expect(@email_message).to have_from(
|
437
|
-
expect(@email_message).to have_reply_to(
|
438
|
-
expect(@email_message).to have_body_text(
|
429
|
+
it 'does not alter non-sanitized attributes' do
|
430
|
+
expect(@email_message).to have_from('same@example.org')
|
431
|
+
expect(@email_message).to have_reply_to('same@example.org')
|
432
|
+
expect(@email_message).to have_body_text('funky fresh')
|
439
433
|
end
|
440
|
-
it
|
441
|
-
expect(@email_message).not_to have_to_username(
|
434
|
+
it 'does not prepend overrides' do
|
435
|
+
expect(@email_message).not_to have_to_username('same at example.org')
|
442
436
|
end
|
443
|
-
it
|
444
|
-
expect(@email_message).to have_to(
|
437
|
+
it 'overrides where original recipients were not nil' do
|
438
|
+
expect(@email_message).to have_to('same@example.org')
|
445
439
|
end
|
446
|
-
it
|
447
|
-
expect(@email_message).not_to have_cc(
|
448
|
-
expect(@email_message).not_to have_bcc(
|
440
|
+
it 'does not override where original recipients were nil' do
|
441
|
+
expect(@email_message).not_to have_cc('same@example.org')
|
442
|
+
expect(@email_message).not_to have_bcc('same@example.org')
|
449
443
|
end
|
450
|
-
it
|
444
|
+
it 'sets headers of originals' do
|
451
445
|
expect(@email_message).to have_header(
|
452
|
-
|
453
|
-
|
446
|
+
'X-Sanitize-Email-To',
|
447
|
+
'same@example.org'
|
454
448
|
)
|
455
449
|
expect(@email_message).to have_header(
|
456
|
-
|
457
|
-
|
450
|
+
'X-Sanitize-Email-Cc',
|
451
|
+
'same@example.org'
|
458
452
|
)
|
459
453
|
end
|
460
|
-
it
|
454
|
+
it 'does not set headers of bcc' do
|
461
455
|
expect(@email_message).not_to have_header(
|
462
|
-
|
463
|
-
|
456
|
+
'X-Sanitize-Email-Bcc',
|
457
|
+
'same@example.org'
|
464
458
|
)
|
465
459
|
end
|
466
|
-
it
|
460
|
+
it 'does not set headers of overrides' do
|
467
461
|
expect(@email_message).not_to have_header(
|
468
|
-
|
469
|
-
|
462
|
+
'X-Sanitize-Email-Bcc',
|
463
|
+
'same@example.org'
|
470
464
|
)
|
471
465
|
# puts "email headers:\n#{@email_message.header}"
|
472
466
|
end
|
473
|
-
it
|
467
|
+
it 'does not prepend originals by default' do
|
474
468
|
expect(@email_message).not_to have_to_username(
|
475
|
-
|
469
|
+
'same at example.org <same@example.org>'
|
476
470
|
)
|
477
471
|
expect(@email_message).not_to have_subject(
|
478
|
-
|
472
|
+
'(same at example.org) original subject'
|
479
473
|
)
|
480
474
|
end
|
481
475
|
end
|
482
476
|
|
483
|
-
context
|
484
|
-
it
|
477
|
+
context 'with frozen string (literals)' do
|
478
|
+
it 'prepends strings without exception' do
|
485
479
|
configure_sanitize_email(
|
486
|
-
environment
|
487
|
-
use_actual_environment_prepended_to_subject
|
480
|
+
:environment => '{{serverABC}}',
|
481
|
+
:use_actual_environment_prepended_to_subject => true
|
488
482
|
)
|
489
|
-
expect { sanitary_mail_delivery_frozen_strings }.
|
483
|
+
expect { sanitary_mail_delivery_frozen_strings }.not_to raise_exception
|
490
484
|
end
|
491
485
|
end
|
492
486
|
|
493
|
-
context
|
494
|
-
context
|
495
|
-
before
|
487
|
+
context 'force_sanitize' do
|
488
|
+
context 'true' do
|
489
|
+
before do
|
496
490
|
# Should turn off sanitization using the force_sanitize
|
497
|
-
configure_sanitize_email(activation_proc
|
498
|
-
|
491
|
+
configure_sanitize_email(:activation_proc => proc { true })
|
492
|
+
described_class.force_sanitize = true
|
499
493
|
mail_delivery
|
500
494
|
end
|
501
|
-
it
|
502
|
-
expect(@email_message).to have_from(
|
503
|
-
expect(@email_message).to have_reply_to(
|
504
|
-
expect(@email_message).to have_body_text(
|
495
|
+
it 'does not alter non-sanitized attributes' do
|
496
|
+
expect(@email_message).to have_from('from@example.org')
|
497
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
498
|
+
expect(@email_message).to have_body_text('funky fresh')
|
505
499
|
end
|
506
|
-
it
|
507
|
-
expect(@email_message).to have_to(
|
508
|
-
expect(@email_message).to have_cc(
|
509
|
-
expect(@email_message).to have_bcc(
|
500
|
+
it 'overrides' do
|
501
|
+
expect(@email_message).to have_to('to@sanitize_email.org')
|
502
|
+
expect(@email_message).to have_cc('cc@sanitize_email.org')
|
503
|
+
expect(@email_message).to have_bcc('bcc@sanitize_email.org')
|
510
504
|
end
|
511
|
-
it
|
505
|
+
it 'sets headers' do
|
512
506
|
expect(@email_message).to have_header(
|
513
|
-
|
514
|
-
|
507
|
+
'X-Sanitize-Email-To',
|
508
|
+
'to@example.org'
|
515
509
|
)
|
516
510
|
expect(@email_message).to have_header(
|
517
|
-
|
518
|
-
|
511
|
+
'X-Sanitize-Email-Cc',
|
512
|
+
'cc@example.org'
|
519
513
|
)
|
520
514
|
expect(@email_message).not_to have_header(
|
521
|
-
|
522
|
-
|
515
|
+
'X-Sanitize-Email-Bcc',
|
516
|
+
'bcc@sanitize_email.org'
|
523
517
|
)
|
524
518
|
end
|
525
519
|
end
|
526
|
-
context
|
527
|
-
before
|
520
|
+
context 'false' do
|
521
|
+
before do
|
528
522
|
# Should turn off sanitization using the force_sanitize
|
529
|
-
configure_sanitize_email(activation_proc
|
530
|
-
|
523
|
+
configure_sanitize_email(:activation_proc => proc { true })
|
524
|
+
described_class.force_sanitize = false
|
531
525
|
mail_delivery
|
532
526
|
end
|
533
|
-
it
|
534
|
-
expect(@email_message).to have_from(
|
535
|
-
expect(@email_message).to have_reply_to(
|
536
|
-
expect(@email_message).to have_body_text(
|
527
|
+
it 'does not alter non-sanitized attributes' do
|
528
|
+
expect(@email_message).to have_from('from@example.org')
|
529
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
530
|
+
expect(@email_message).to have_body_text('funky fresh')
|
537
531
|
end
|
538
|
-
it
|
539
|
-
expect(@email_message).to have_to(
|
540
|
-
expect(@email_message).to have_cc(
|
541
|
-
expect(@email_message).to have_bcc(
|
532
|
+
it 'does not alter normally sanitized attributes' do
|
533
|
+
expect(@email_message).to have_to('to@example.org')
|
534
|
+
expect(@email_message).to have_cc('cc@example.org')
|
535
|
+
expect(@email_message).to have_bcc('bcc@example.org')
|
542
536
|
expect(@email_message).not_to have_header(
|
543
|
-
|
544
|
-
|
537
|
+
'X-Sanitize-Email-To',
|
538
|
+
'to@example.org'
|
545
539
|
)
|
546
540
|
expect(@email_message).not_to have_header(
|
547
|
-
|
548
|
-
|
541
|
+
'X-Sanitize-Email-Cc',
|
542
|
+
'cc@example.org'
|
549
543
|
)
|
550
544
|
expect(@email_message).not_to have_header(
|
551
|
-
|
552
|
-
|
545
|
+
'X-Sanitize-Email-Bcc',
|
546
|
+
'bcc@example.org'
|
553
547
|
)
|
554
548
|
end
|
555
549
|
end
|
556
|
-
context
|
557
|
-
context
|
558
|
-
before
|
550
|
+
context 'nil' do
|
551
|
+
context 'activation proc enables' do
|
552
|
+
before do
|
559
553
|
# Should ignore force_sanitize setting
|
560
|
-
configure_sanitize_email(activation_proc
|
561
|
-
|
554
|
+
configure_sanitize_email(:activation_proc => proc { true })
|
555
|
+
described_class.force_sanitize = nil
|
562
556
|
mail_delivery
|
563
557
|
end
|
564
|
-
it
|
565
|
-
expect(@email_message).to have_from(
|
566
|
-
expect(@email_message).to have_reply_to(
|
567
|
-
expect(@email_message).to have_body_text(
|
558
|
+
it 'does not alter non-sanitized attributes' do
|
559
|
+
expect(@email_message).to have_from('from@example.org')
|
560
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
561
|
+
expect(@email_message).to have_body_text('funky fresh')
|
568
562
|
end
|
569
|
-
it
|
570
|
-
expect(@email_message).to have_to(
|
571
|
-
expect(@email_message).to have_cc(
|
572
|
-
expect(@email_message).to have_bcc(
|
563
|
+
it 'overrides' do
|
564
|
+
expect(@email_message).to have_to('to@sanitize_email.org')
|
565
|
+
expect(@email_message).to have_cc('cc@sanitize_email.org')
|
566
|
+
expect(@email_message).to have_bcc('bcc@sanitize_email.org')
|
573
567
|
expect(@email_message).to have_header(
|
574
|
-
|
575
|
-
|
568
|
+
'X-Sanitize-Email-To',
|
569
|
+
'to@example.org'
|
576
570
|
)
|
577
571
|
expect(@email_message).to have_header(
|
578
|
-
|
579
|
-
|
572
|
+
'X-Sanitize-Email-Cc',
|
573
|
+
'cc@example.org'
|
580
574
|
)
|
581
575
|
expect(@email_message).not_to have_header(
|
582
|
-
|
583
|
-
|
576
|
+
'X-Sanitize-Email-Bcc',
|
577
|
+
'bcc@sanitize_email.org'
|
584
578
|
)
|
585
579
|
end
|
586
580
|
end
|
587
|
-
context
|
588
|
-
before
|
581
|
+
context 'activation proc disables' do
|
582
|
+
before do
|
589
583
|
# Should ignore force_sanitize setting
|
590
|
-
configure_sanitize_email(activation_proc
|
591
|
-
|
584
|
+
configure_sanitize_email(:activation_proc => proc { false })
|
585
|
+
described_class.force_sanitize = nil
|
592
586
|
mail_delivery
|
593
587
|
end
|
594
|
-
it
|
595
|
-
expect(@email_message).to have_from(
|
596
|
-
expect(@email_message).to have_reply_to(
|
597
|
-
expect(@email_message).to have_body_text(
|
588
|
+
it 'does not alter non-sanitized attributes' do
|
589
|
+
expect(@email_message).to have_from('from@example.org')
|
590
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
591
|
+
expect(@email_message).to have_body_text('funky fresh')
|
598
592
|
end
|
599
|
-
it
|
600
|
-
expect(@email_message).to have_to(
|
601
|
-
expect(@email_message).to have_cc(
|
602
|
-
expect(@email_message).to have_bcc(
|
593
|
+
it 'does not alter normally sanitized attributes' do
|
594
|
+
expect(@email_message).to have_to('to@example.org')
|
595
|
+
expect(@email_message).to have_cc('cc@example.org')
|
596
|
+
expect(@email_message).to have_bcc('bcc@example.org')
|
603
597
|
expect(@email_message).not_to have_header(
|
604
|
-
|
605
|
-
|
598
|
+
'X-Sanitize-Email-To',
|
599
|
+
'to@example.org'
|
606
600
|
)
|
607
601
|
expect(@email_message).not_to have_header(
|
608
|
-
|
609
|
-
|
602
|
+
'X-Sanitize-Email-Cc',
|
603
|
+
'cc@example.org'
|
610
604
|
)
|
611
605
|
expect(@email_message).not_to have_header(
|
612
|
-
|
613
|
-
|
606
|
+
'X-Sanitize-Email-Bcc',
|
607
|
+
'bcc@example.org'
|
614
608
|
)
|
615
609
|
end
|
616
610
|
end
|
@@ -618,331 +612,333 @@ describe SanitizeEmail do
|
|
618
612
|
end
|
619
613
|
end
|
620
614
|
|
621
|
-
context
|
622
|
-
context
|
623
|
-
context
|
624
|
-
before
|
615
|
+
context 'config options' do
|
616
|
+
context ':use_actual_environment_prepended_to_subject' do
|
617
|
+
context 'true' do
|
618
|
+
before do
|
625
619
|
configure_sanitize_email(
|
626
|
-
environment
|
627
|
-
use_actual_environment_prepended_to_subject
|
620
|
+
:environment => '{{serverABC}}',
|
621
|
+
:use_actual_environment_prepended_to_subject => true
|
628
622
|
)
|
629
623
|
sanitary_mail_delivery
|
630
624
|
end
|
631
|
-
it
|
625
|
+
it 'original to is prepended' do
|
632
626
|
expect(@email_message).to have_subject(
|
633
|
-
|
627
|
+
'{{serverABC}} original subject'
|
634
628
|
)
|
635
629
|
end
|
636
|
-
it
|
637
|
-
expect(@email_message).to have_from(
|
638
|
-
expect(@email_message).to have_reply_to(
|
639
|
-
expect(@email_message).to have_body_text(
|
630
|
+
it 'does not alter non-sanitized attributes' do
|
631
|
+
expect(@email_message).to have_from('from@example.org')
|
632
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
633
|
+
expect(@email_message).to have_body_text('funky fresh')
|
640
634
|
end
|
641
|
-
it
|
635
|
+
it 'does not prepend overrides' do
|
642
636
|
expect(@email_message).not_to have_to_username(
|
643
|
-
|
637
|
+
'to at sanitize_email.org'
|
644
638
|
)
|
645
639
|
expect(@email_message).not_to have_subject(
|
646
|
-
|
640
|
+
'(to at sanitize_email.org)'
|
647
641
|
)
|
648
642
|
end
|
649
643
|
end
|
650
|
-
context
|
651
|
-
before
|
644
|
+
context 'false' do
|
645
|
+
before do
|
652
646
|
configure_sanitize_email(
|
653
|
-
environment
|
654
|
-
use_actual_environment_prepended_to_subject
|
647
|
+
:environment => '{{serverABC}}',
|
648
|
+
:use_actual_environment_prepended_to_subject => false
|
655
649
|
)
|
656
650
|
sanitary_mail_delivery
|
657
651
|
end
|
658
|
-
it
|
652
|
+
it 'original to is not prepended' do
|
659
653
|
expect(@email_message).not_to have_subject(
|
660
|
-
|
654
|
+
'{{serverABC}} original subject'
|
661
655
|
)
|
662
|
-
expect(@email_message.subject).to eq(
|
656
|
+
expect(@email_message.subject).to eq('original subject')
|
663
657
|
end
|
664
|
-
it
|
665
|
-
expect(@email_message).to have_from(
|
666
|
-
expect(@email_message).to have_reply_to(
|
667
|
-
expect(@email_message).to have_body_text(
|
658
|
+
it 'does not alter non-sanitized attributes' do
|
659
|
+
expect(@email_message).to have_from('from@example.org')
|
660
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
661
|
+
expect(@email_message).to have_body_text('funky fresh')
|
668
662
|
end
|
669
|
-
it
|
663
|
+
it 'does not prepend overrides' do
|
670
664
|
expect(@email_message).not_to have_to_username(
|
671
|
-
|
665
|
+
'to at sanitize_email.org'
|
672
666
|
)
|
673
667
|
expect(@email_message).not_to have_subject(
|
674
|
-
|
668
|
+
'(to at sanitize_email.org)'
|
675
669
|
)
|
676
670
|
end
|
677
671
|
end
|
678
672
|
end
|
679
673
|
|
680
|
-
context
|
681
|
-
context
|
682
|
-
before
|
683
|
-
configure_sanitize_email(use_actual_email_prepended_to_subject
|
674
|
+
context ':use_actual_email_prepended_to_subject' do
|
675
|
+
context 'true' do
|
676
|
+
before do
|
677
|
+
configure_sanitize_email(:use_actual_email_prepended_to_subject => true)
|
684
678
|
end
|
685
|
-
context
|
679
|
+
context 'to address is an array' do
|
686
680
|
before do
|
687
681
|
sanitary_mail_delivery_multiple_recipients
|
688
682
|
end
|
689
|
-
it
|
683
|
+
it 'original to is prepended' do
|
690
684
|
expect(@email_message).to have_subject(
|
691
|
-
|
685
|
+
'(to1 at example.org,to2 at example.org,to3 at example.org) original subject'
|
692
686
|
)
|
693
687
|
end
|
694
|
-
it
|
695
|
-
expect(@email_message).to have_from(
|
696
|
-
expect(@email_message).to have_reply_to(
|
697
|
-
expect(@email_message).to have_body_text(
|
688
|
+
it 'does not alter non-sanitized attributes' do
|
689
|
+
expect(@email_message).to have_from('from@example.org')
|
690
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
691
|
+
expect(@email_message).to have_body_text('funky fresh')
|
698
692
|
end
|
699
|
-
it
|
693
|
+
it 'does not prepend overrides' do
|
700
694
|
expect(@email_message).not_to have_to_username(
|
701
|
-
|
695
|
+
'to at sanitize_email.org'
|
702
696
|
)
|
703
697
|
expect(@email_message).not_to have_subject(
|
704
|
-
|
698
|
+
'(to at sanitize_email.org)'
|
705
699
|
)
|
706
700
|
end
|
707
701
|
end
|
708
|
-
context
|
702
|
+
context 'to address is not an array' do
|
709
703
|
before do
|
710
704
|
sanitary_mail_delivery
|
711
705
|
end
|
712
|
-
it
|
706
|
+
it 'original to is prepended' do
|
713
707
|
expect(@email_message).to have_subject(
|
714
|
-
|
708
|
+
'(to at example.org) original subject'
|
715
709
|
)
|
716
710
|
end
|
717
|
-
it
|
718
|
-
expect(@email_message).to have_from(
|
719
|
-
expect(@email_message).to have_reply_to(
|
720
|
-
expect(@email_message).to have_body_text(
|
711
|
+
it 'does not alter non-sanitized attributes' do
|
712
|
+
expect(@email_message).to have_from('from@example.org')
|
713
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
714
|
+
expect(@email_message).to have_body_text('funky fresh')
|
721
715
|
end
|
722
|
-
it
|
716
|
+
it 'does not prepend overrides' do
|
723
717
|
expect(@email_message).not_to have_to_username(
|
724
|
-
|
718
|
+
'to at sanitize_email.org'
|
725
719
|
)
|
726
720
|
expect(@email_message).not_to have_subject(
|
727
|
-
|
721
|
+
'(to at sanitize_email.org)'
|
728
722
|
)
|
729
723
|
end
|
730
724
|
end
|
731
725
|
end
|
732
|
-
context
|
733
|
-
before
|
734
|
-
configure_sanitize_email(use_actual_email_prepended_to_subject
|
726
|
+
context 'false' do
|
727
|
+
before do
|
728
|
+
configure_sanitize_email(:use_actual_email_prepended_to_subject => false)
|
735
729
|
sanitary_mail_delivery
|
736
730
|
end
|
737
|
-
it
|
731
|
+
it 'original to is not prepended' do
|
738
732
|
expect(@email_message).not_to have_subject(
|
739
|
-
|
733
|
+
'(to at example.org) original subject'
|
740
734
|
)
|
741
735
|
end
|
742
|
-
it
|
743
|
-
expect(@email_message).to have_from(
|
744
|
-
expect(@email_message).to have_reply_to(
|
745
|
-
expect(@email_message).to have_body_text(
|
736
|
+
it 'does not alter non-sanitized attributes' do
|
737
|
+
expect(@email_message).to have_from('from@example.org')
|
738
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
739
|
+
expect(@email_message).to have_body_text('funky fresh')
|
746
740
|
end
|
747
|
-
it
|
741
|
+
it 'does not prepend overrides' do
|
748
742
|
expect(@email_message).not_to have_to_username(
|
749
|
-
|
743
|
+
'to at sanitize_email.org'
|
750
744
|
)
|
751
745
|
expect(@email_message).not_to have_subject(
|
752
|
-
|
746
|
+
'(to at sanitize_email.org)'
|
753
747
|
)
|
754
748
|
end
|
755
749
|
end
|
756
750
|
end
|
757
751
|
|
758
|
-
context
|
759
|
-
context
|
760
|
-
before
|
752
|
+
context ':use_actual_email_as_sanitized_user_name' do
|
753
|
+
context 'true' do
|
754
|
+
before do
|
761
755
|
configure_sanitize_email(
|
762
|
-
use_actual_email_as_sanitized_user_name
|
756
|
+
:use_actual_email_as_sanitized_user_name => true
|
763
757
|
)
|
764
758
|
sanitary_mail_delivery
|
765
759
|
end
|
766
|
-
it
|
760
|
+
it 'original to is munged and prepended' do
|
767
761
|
expect(@email_message).to have_to_username(
|
768
|
-
|
762
|
+
'to at example.org <to@sanitize_email.org>'
|
769
763
|
)
|
770
764
|
end
|
771
|
-
it
|
772
|
-
expect(@email_message).to have_from(
|
773
|
-
expect(@email_message).to have_reply_to(
|
774
|
-
expect(@email_message).to have_body_text(
|
765
|
+
it 'does not alter non-sanitized attributes' do
|
766
|
+
expect(@email_message).to have_from('from@example.org')
|
767
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
768
|
+
expect(@email_message).to have_body_text('funky fresh')
|
775
769
|
end
|
776
|
-
it
|
770
|
+
it 'does not prepend overrides' do
|
777
771
|
expect(@email_message).not_to have_to_username(
|
778
|
-
|
772
|
+
'to at sanitize_email.org'
|
779
773
|
)
|
780
774
|
expect(@email_message).not_to have_subject(
|
781
|
-
|
775
|
+
'(to at sanitize_email.org)'
|
782
776
|
)
|
783
777
|
end
|
784
778
|
end
|
785
|
-
context
|
786
|
-
before
|
779
|
+
context 'false' do
|
780
|
+
before do
|
787
781
|
configure_sanitize_email(
|
788
|
-
use_actual_email_as_sanitized_user_name
|
782
|
+
:use_actual_email_as_sanitized_user_name => false
|
789
783
|
)
|
790
784
|
sanitary_mail_delivery
|
791
785
|
end
|
792
|
-
it
|
786
|
+
it 'original to is not prepended' do
|
793
787
|
expect(@email_message).not_to have_to_username(
|
794
|
-
|
788
|
+
'to at example.org <to@sanitize_email.org>'
|
795
789
|
)
|
796
790
|
end
|
797
|
-
it
|
798
|
-
expect(@email_message).to have_from(
|
799
|
-
expect(@email_message).to have_reply_to(
|
800
|
-
expect(@email_message).to have_body_text(
|
791
|
+
it 'does not alter non-sanitized attributes' do
|
792
|
+
expect(@email_message).to have_from('from@example.org')
|
793
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
794
|
+
expect(@email_message).to have_body_text('funky fresh')
|
801
795
|
end
|
802
|
-
it
|
796
|
+
it 'does not prepend overrides' do
|
803
797
|
expect(@email_message).not_to have_to_username(
|
804
|
-
|
798
|
+
'to at sanitize_email.org'
|
805
799
|
)
|
806
800
|
expect(@email_message).not_to have_subject(
|
807
|
-
|
801
|
+
'(to at sanitize_email.org)'
|
808
802
|
)
|
809
803
|
end
|
810
804
|
end
|
811
805
|
end
|
812
806
|
|
813
|
-
context
|
814
|
-
context
|
815
|
-
before
|
807
|
+
context ':engage' do
|
808
|
+
context 'is true' do
|
809
|
+
before do
|
816
810
|
# Should turn off sanitization using the force_sanitize
|
817
811
|
configure_sanitize_email(
|
818
|
-
engage
|
819
|
-
sanitized_recipients
|
820
|
-
use_actual_email_prepended_to_subject
|
821
|
-
use_actual_email_as_sanitized_user_name
|
812
|
+
:engage => true,
|
813
|
+
:sanitized_recipients => 'marv@example.org',
|
814
|
+
:use_actual_email_prepended_to_subject => true,
|
815
|
+
:use_actual_email_as_sanitized_user_name => true
|
822
816
|
)
|
823
817
|
mail_delivery
|
824
818
|
end
|
825
|
-
it
|
826
|
-
expect(@email_message).to have_from(
|
827
|
-
expect(@email_message).to have_reply_to(
|
828
|
-
expect(@email_message).to have_body_text(
|
819
|
+
it 'does not alter non-sanitized attributes' do
|
820
|
+
expect(@email_message).to have_from('from@example.org')
|
821
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
822
|
+
expect(@email_message).to have_body_text('funky fresh')
|
829
823
|
end
|
830
|
-
it
|
831
|
-
expect(@email_message).to have_to_username(
|
832
|
-
expect(@email_message).to have_subject(
|
824
|
+
it 'prepends overrides' do
|
825
|
+
expect(@email_message).to have_to_username('to at example.org')
|
826
|
+
expect(@email_message).to have_subject('(to at example.org)')
|
833
827
|
end
|
834
|
-
it
|
835
|
-
expect(@email_message).not_to have_to(
|
836
|
-
expect(@email_message).to have_to(
|
828
|
+
it 'alters normally sanitized attributes' do
|
829
|
+
expect(@email_message).not_to have_to('to@example.org')
|
830
|
+
expect(@email_message).to have_to('marv@example.org')
|
837
831
|
end
|
838
832
|
end
|
839
|
-
context
|
840
|
-
before
|
833
|
+
context 'is false' do
|
834
|
+
before do
|
841
835
|
# Should turn off sanitization using the force_sanitize
|
842
836
|
configure_sanitize_email(
|
843
|
-
engage
|
844
|
-
sanitized_recipients
|
845
|
-
use_actual_email_prepended_to_subject
|
846
|
-
use_actual_email_as_sanitized_user_name
|
837
|
+
:engage => false,
|
838
|
+
:sanitized_recipients => 'marv@example.org',
|
839
|
+
:use_actual_email_prepended_to_subject => true,
|
840
|
+
:use_actual_email_as_sanitized_user_name => true
|
847
841
|
)
|
848
842
|
mail_delivery
|
849
843
|
end
|
850
|
-
it
|
851
|
-
expect(@email_message).to have_from(
|
852
|
-
expect(@email_message).to have_reply_to(
|
853
|
-
expect(@email_message).to have_body_text(
|
844
|
+
it 'does not alter non-sanitized attributes' do
|
845
|
+
expect(@email_message).to have_from('from@example.org')
|
846
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
847
|
+
expect(@email_message).to have_body_text('funky fresh')
|
854
848
|
end
|
855
|
-
it
|
856
|
-
expect(@email_message).not_to have_to_username(
|
857
|
-
expect(@email_message).not_to have_subject(
|
849
|
+
it 'does not prepend overrides' do
|
850
|
+
expect(@email_message).not_to have_to_username('to at example.org')
|
851
|
+
expect(@email_message).not_to have_subject('(to at example.org)')
|
858
852
|
end
|
859
|
-
it
|
860
|
-
expect(@email_message).to have_to(
|
861
|
-
expect(@email_message).not_to have_to(
|
853
|
+
it 'does not alter normally sanitized attributes' do
|
854
|
+
expect(@email_message).to have_to('to@example.org')
|
855
|
+
expect(@email_message).not_to have_to('marv@example.org')
|
862
856
|
end
|
863
857
|
end
|
864
858
|
end
|
865
859
|
|
866
|
-
context
|
867
|
-
#before(:each) do
|
860
|
+
context 'deprecated' do
|
861
|
+
# before(:each) do
|
868
862
|
# SanitizeEmail::Deprecation.deprecate_in_silence = false
|
869
|
-
#end
|
870
|
-
context
|
871
|
-
context
|
872
|
-
before
|
873
|
-
configure_sanitize_email(local_environments
|
874
|
-
expect(SanitizeEmail[:activation_proc].call).to eq(true)
|
863
|
+
# end
|
864
|
+
context ':local_environments' do
|
865
|
+
context 'matching' do
|
866
|
+
before do
|
867
|
+
configure_sanitize_email(:local_environments => ['test'])
|
875
868
|
mail_delivery
|
876
869
|
end
|
877
|
-
it
|
878
|
-
expect(
|
879
|
-
expect(@email_message).to
|
880
|
-
expect(@email_message).to
|
870
|
+
it 'does not alter non-sanitized attributes' do
|
871
|
+
expect(described_class[:activation_proc].call).to eq(true)
|
872
|
+
expect(@email_message).to have_from('from@example.org')
|
873
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
874
|
+
expect(@email_message).to have_body_text('funky fresh')
|
881
875
|
end
|
882
|
-
it
|
883
|
-
expect(
|
884
|
-
expect(@email_message).to
|
885
|
-
expect(@email_message).to
|
876
|
+
it 'uses activation_proc for matching environment' do
|
877
|
+
expect(described_class[:activation_proc].call).to eq(true)
|
878
|
+
expect(@email_message).to match_to('to@sanitize_email.org')
|
879
|
+
expect(@email_message).to match_cc('cc@sanitize_email.org')
|
880
|
+
expect(@email_message).to match_bcc('bcc@sanitize_email.org')
|
886
881
|
end
|
887
882
|
end
|
888
|
-
context
|
889
|
-
before
|
890
|
-
sanitize_spec_dryer(
|
883
|
+
context 'non-matching' do
|
884
|
+
before do
|
885
|
+
sanitize_spec_dryer('production')
|
891
886
|
# Won't match!
|
892
|
-
configure_sanitize_email(local_environments
|
893
|
-
expect(SanitizeEmail[:activation_proc].call).to eq(false)
|
887
|
+
configure_sanitize_email(:local_environments => ['development'])
|
894
888
|
mail_delivery
|
895
889
|
end
|
896
|
-
it
|
897
|
-
expect(
|
898
|
-
expect(@email_message).to
|
899
|
-
expect(@email_message).to
|
890
|
+
it 'does not alter non-sanitized attributes' do
|
891
|
+
expect(described_class[:activation_proc].call).to eq(false)
|
892
|
+
expect(@email_message).to have_from('from@example.org')
|
893
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
894
|
+
expect(@email_message).to have_body_text('funky fresh')
|
900
895
|
end
|
901
|
-
it
|
902
|
-
expect(
|
903
|
-
expect(@email_message).to
|
904
|
-
expect(@email_message).to
|
896
|
+
it 'uses activation_proc for non-matching environment' do
|
897
|
+
expect(described_class[:activation_proc].call).to eq(false)
|
898
|
+
expect(@email_message).to have_to('to@example.org')
|
899
|
+
expect(@email_message).to have_cc('cc@example.org')
|
900
|
+
expect(@email_message).to have_bcc('bcc@example.org')
|
905
901
|
end
|
906
902
|
end
|
907
903
|
end
|
908
904
|
|
909
|
-
context
|
910
|
-
before
|
905
|
+
context ':sanitized_recipients' do
|
906
|
+
before do
|
911
907
|
configure_sanitize_email(
|
912
|
-
sanitized_recipients
|
908
|
+
:sanitized_recipients => 'barney@sanitize_email.org'
|
913
909
|
)
|
914
910
|
sanitary_mail_delivery
|
915
911
|
end
|
916
|
-
it
|
917
|
-
expect(@email_message).to have_from(
|
918
|
-
expect(@email_message).to have_reply_to(
|
919
|
-
expect(@email_message).to have_body_text(
|
912
|
+
it 'does not alter non-sanitized attributes' do
|
913
|
+
expect(@email_message).to have_from('from@example.org')
|
914
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
915
|
+
expect(@email_message).to have_body_text('funky fresh')
|
920
916
|
end
|
921
|
-
it
|
922
|
-
expect(@email_message).to have_to(
|
917
|
+
it 'used as sanitized_to' do
|
918
|
+
expect(@email_message).to have_to('barney@sanitize_email.org')
|
923
919
|
end
|
924
920
|
end
|
925
921
|
|
926
|
-
context
|
927
|
-
before
|
922
|
+
context ':force_sanitize' do
|
923
|
+
before do
|
928
924
|
# Should turn off sanitization using the force_sanitize
|
929
925
|
configure_sanitize_email(
|
930
|
-
activation_proc
|
931
|
-
force_sanitize
|
926
|
+
:activation_proc => proc { true },
|
927
|
+
:force_sanitize => false
|
932
928
|
)
|
933
929
|
mail_delivery
|
934
930
|
end
|
935
|
-
it
|
936
|
-
expect(@email_message).to have_from(
|
937
|
-
expect(@email_message).to have_reply_to(
|
938
|
-
expect(@email_message).to have_body_text(
|
931
|
+
it 'does not alter non-sanitized attributes' do
|
932
|
+
expect(@email_message).to have_from('from@example.org')
|
933
|
+
expect(@email_message).to have_reply_to('reply_to@example.org')
|
934
|
+
expect(@email_message).to have_body_text('funky fresh')
|
939
935
|
end
|
940
|
-
it
|
941
|
-
expect(@email_message).to have_to(
|
936
|
+
it 'does not alter normally sanitized attributes' do
|
937
|
+
expect(@email_message).to have_to('to@example.org')
|
942
938
|
end
|
943
939
|
end
|
944
940
|
end
|
945
941
|
end
|
946
942
|
end
|
947
943
|
|
948
|
-
#TODO: test good_list
|
944
|
+
# TODO: test good_list
|