mail_spy 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +86 -24
- data/app/assets/images/mail_spy/background_tile.gif +0 -0
- data/app/assets/images/mail_spy/mailspy_sprite.png +0 -0
- data/app/assets/images/mail_spy/spy.ico +0 -0
- data/app/assets/javascripts/mail_spy/lib/backbone.js +1256 -0
- data/app/assets/javascripts/mail_spy/lib/underscore.js +999 -0
- data/app/assets/javascripts/mail_spy/reports.js +2 -0
- data/app/assets/javascripts/mail_spy/sendgrid.js +2 -0
- data/app/assets/stylesheets/mail_spy/application.css +62 -1
- data/app/assets/stylesheets/mail_spy/reports.css.scss +128 -0
- data/app/assets/stylesheets/mail_spy/sendgrid.css +4 -0
- data/app/controllers/mail_spy/reports_controller.rb +29 -0
- data/app/controllers/mail_spy/sendgrid_controller.rb +26 -0
- data/app/controllers/mail_spy/tracking_controller.rb +19 -11
- data/app/helpers/mail_spy/email_helper.rb +21 -3
- data/app/helpers/mail_spy/reports_helper.rb +4 -0
- data/app/helpers/mail_spy/sendgrid_helper.rb +4 -0
- data/app/mailers/mail_spy/core_mailer.rb +15 -18
- data/app/models/mail_spy/email.rb +127 -19
- data/app/models/mail_spy/process_log.rb +25 -0
- data/app/views/layouts/mail_spy/application.html.erb +3 -0
- data/app/views/mail_spy/reports/campaigns.html.erb +138 -0
- data/config/routes.rb +6 -0
- data/lib/generators/mail_spy/templates/mail_spy.rb +25 -1
- data/lib/mail_spy/manager.rb +100 -54
- data/lib/mail_spy/sendgrid/smtp_api_header.rb +68 -0
- data/lib/mail_spy/version.rb +1 -1
- data/lib/mail_spy.rb +39 -5
- data/test/dummy/app/views/email_templates/helper_test.html.erb +15 -0
- data/test/dummy/app/views/email_templates/helper_test.text.erb +11 -0
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +5 -1
- data/test/dummy/config/environments/test.rb +4 -1
- data/test/dummy/config/initializers/mail_spy.rb +42 -0
- data/test/dummy/config/routes.rb +1 -2
- data/test/dummy/db/schema.rb +16 -0
- data/test/dummy/db/seeds.rb +16 -13
- data/test/dummy/lib/tasks/emails.rake +8 -0
- data/test/dummy/log/development.log +782 -0
- data/test/dummy/log/test.log +9952 -0
- data/test/fixtures/mail_spy/process_logs.yml +15 -0
- data/test/functional/mail_spy/core_mailer_test.rb +16 -9
- data/test/functional/mail_spy/reports_controller_test.rb +9 -0
- data/test/functional/mail_spy/sendgrid_controller_test.rb +9 -0
- data/test/functional/mail_spy/tracking_controller_test.rb +16 -11
- data/test/test_email_credentials.yml +2 -2
- data/test/test_email_credentials.yml.sample +0 -8
- data/test/test_helper.rb +15 -41
- data/test/unit/helpers/mail_spy/reports_helper_test.rb +6 -0
- data/test/unit/helpers/mail_spy/sendgrid_helper_test.rb +6 -0
- data/test/unit/mail_spy/manager_test.rb +101 -122
- data/test/unit/mail_spy/{email_template_test.rb → process_log_test.rb} +1 -1
- metadata +122 -34
- data/app/models/mail_spy/email_template.rb +0 -17
- data/test/fixtures/mail_spy/email_templates.yml +0 -9
- /data/lib/generators/mail_spy/{initialize_generator.rb → initializer_generator.rb} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
|
2
|
+
|
|
3
|
+
one:
|
|
4
|
+
start: 2012-02-06 23:54:22
|
|
5
|
+
end: 2012-02-06 23:54:22
|
|
6
|
+
seconds_elapsed: 1
|
|
7
|
+
running: false
|
|
8
|
+
success: false
|
|
9
|
+
|
|
10
|
+
two:
|
|
11
|
+
start: 2012-02-06 23:54:22
|
|
12
|
+
end: 2012-02-06 23:54:22
|
|
13
|
+
seconds_elapsed: 1
|
|
14
|
+
running: false
|
|
15
|
+
success: false
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
module MailSpy
|
|
4
|
-
class CoreMailerTest < ActionMailer::TestCase
|
|
4
|
+
class CoreMailerTest < ActiveSupport::TestCase #ActionMailer::TestCase
|
|
5
5
|
|
|
6
6
|
def teardown
|
|
7
|
-
MailSpy::EmailTemplate.delete_all
|
|
8
7
|
MailSpy::Email.delete_all
|
|
9
8
|
end
|
|
10
9
|
|
|
@@ -12,17 +11,25 @@ module MailSpy
|
|
|
12
11
|
assert true
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
def
|
|
16
|
-
|
|
14
|
+
def test_subject_evaluation
|
|
15
|
+
emails = create_emails(:campaign => "tests", :stream => "a-stream", :component => "a-helper_test")
|
|
16
|
+
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
email = emails.first
|
|
19
|
+
email.template_values = {:user_name => "bob"}
|
|
20
|
+
email.subject = "hi <%= @template_values[:user_name] %>"
|
|
21
|
+
|
|
22
|
+
mail = MailSpy::CoreMailer.template(emails.first)
|
|
23
|
+
assert(mail.subject == "hi bob", "subject lines should be interpreted")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_template_email_helpers
|
|
28
|
+
create_emails(:campaign => "tests", :stream => "a-stream", :component => "a-helper_test")
|
|
21
29
|
|
|
22
|
-
template = MailSpy.add_template("a test template", html_erb, text_erb, template_values_definition)
|
|
23
|
-
create_emails(template)
|
|
24
30
|
email = MailSpy::Email.first
|
|
25
31
|
mail = MailSpy::CoreMailer.template(email)
|
|
32
|
+
mail.deliver
|
|
26
33
|
|
|
27
34
|
assert(mail.present?, "Mail should render without error")
|
|
28
35
|
assert(mail.html_part.body.present?, "Mail should have a html part")
|
|
@@ -4,19 +4,12 @@ module MailSpy
|
|
|
4
4
|
class TrackingControllerTest < ActionController::TestCase
|
|
5
5
|
|
|
6
6
|
def setup
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
html_erb = "A link : <%= track_link 'My home', 'www.google.com' %> <br> A Bug <%= tracking_bug %>"
|
|
10
|
-
text_erb = "A link : <%= track_link 'My home', 'www.google.com' %> <br> A Bug <%= tracking_bug %>"
|
|
11
|
-
template_values_definition = {}
|
|
12
|
-
|
|
13
|
-
template = MailSpy.add_template("a test template", html_erb, text_erb, template_values_definition)
|
|
14
|
-
create_emails(template)
|
|
7
|
+
MailSpy::Email.delete_all
|
|
8
|
+
create_emails(:campaign => "tests", :stream => "a-stream", :component => "a-helper_test")
|
|
15
9
|
@email = MailSpy::Email.first
|
|
16
10
|
end
|
|
17
11
|
|
|
18
12
|
def teardown
|
|
19
|
-
MailSpy::EmailTemplate.delete_all
|
|
20
13
|
MailSpy::Email.delete_all
|
|
21
14
|
end
|
|
22
15
|
|
|
@@ -33,7 +26,19 @@ module MailSpy
|
|
|
33
26
|
|
|
34
27
|
get "link", params
|
|
35
28
|
|
|
36
|
-
|
|
29
|
+
#Load up the generated GA tokens
|
|
30
|
+
ga_hash = {}
|
|
31
|
+
email = MailSpy::Email.first
|
|
32
|
+
ga_hash[:utm_source] = email.utm_source if email.utm_source.present?
|
|
33
|
+
ga_hash[:utm_medium] = email.utm_medium if email.utm_medium.present?
|
|
34
|
+
ga_hash[:utm_campaign] = email.utm_campaign if email.utm_campaign.present?
|
|
35
|
+
ga_hash[:utm_term] = email.utm_term if email.utm_term.present?
|
|
36
|
+
ga_hash[:utm_content] = email.utm_content if email.utm_content.present?
|
|
37
|
+
|
|
38
|
+
#Parse tokens into uri
|
|
39
|
+
uri = URI.parse(params[:url])
|
|
40
|
+
uri.query = [uri.query, ga_hash.to_param].compact.join('&')
|
|
41
|
+
assert_redirected_to uri.to_s
|
|
37
42
|
|
|
38
43
|
email = @email.reload
|
|
39
44
|
details = email.actions.first.details
|
|
@@ -74,7 +79,7 @@ module MailSpy
|
|
|
74
79
|
email = @email.reload
|
|
75
80
|
assert(email.actions.length == 1, "The email should only have on action at this point")
|
|
76
81
|
assert(email.actions.first.action_type == params[:action_type],"Action type should be conversion")
|
|
77
|
-
assert(email.actions.first.count == params[:count], "the action count should be
|
|
82
|
+
assert(email.actions.first.count == params[:count], "the action count should be 3")
|
|
78
83
|
|
|
79
84
|
end
|
|
80
85
|
|
|
@@ -2,8 +2,8 @@ name: sendgrid
|
|
|
2
2
|
address: smtp.sendgrid.net
|
|
3
3
|
port: 587
|
|
4
4
|
domain: herokuapp.com
|
|
5
|
-
user_name:
|
|
6
|
-
password:
|
|
5
|
+
user_name: app2602840@heroku.com
|
|
6
|
+
password: qb6qnim0
|
|
7
7
|
authentication: plain
|
|
8
8
|
enable_starttls_auto: 1
|
|
9
9
|
test_email_address: trcarden@gmail.com
|
data/test/test_helper.rb
CHANGED
|
@@ -33,23 +33,6 @@ class ActiveSupport::TestCase
|
|
|
33
33
|
# Add more helper methods to be used by all tests here...
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
# Adds the ESP settings for a test email
|
|
38
|
-
def initialize_mail_spy_test_esp
|
|
39
|
-
path = File.expand_path ".././test_email_credentials.yml", __FILE__
|
|
40
|
-
credentials = YAML.load(File.open(path)).to_options
|
|
41
|
-
MailSpy.add_email_service_provider do |esp|
|
|
42
|
-
esp.name = credentials[:name]
|
|
43
|
-
esp.address = credentials[:address]
|
|
44
|
-
esp.port = credentials[:port]
|
|
45
|
-
esp.domain = credentials[:domain]
|
|
46
|
-
esp.user_name = credentials[:user_name]
|
|
47
|
-
esp.password = credentials[:password]
|
|
48
|
-
esp.authentication = credentials[:authentication]
|
|
49
|
-
esp.enable_starttls_auto = (credentials[:enable_starttls_auto].to_i == 1)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
36
|
# Gets the test email address from the setup file
|
|
54
37
|
def email_address_for_test
|
|
55
38
|
path = File.expand_path ".././test_email_credentials.yml", __FILE__
|
|
@@ -57,36 +40,26 @@ class ActiveSupport::TestCase
|
|
|
57
40
|
credentials[:test_email_address]
|
|
58
41
|
end
|
|
59
42
|
|
|
60
|
-
#
|
|
61
|
-
def
|
|
62
|
-
|
|
63
|
-
html_erb = "Hello World"
|
|
64
|
-
text_erb = "Hello World"
|
|
65
|
-
template_values_definition = {}
|
|
66
|
-
|
|
67
|
-
template = MailSpy.add_template(template_name, html_erb, text_erb, template_values_definition)
|
|
68
|
-
block.call(template)
|
|
69
|
-
end
|
|
43
|
+
# Creates a test email
|
|
44
|
+
def create_emails( options={}, num_emails=1)
|
|
45
|
+
options.to_options!
|
|
70
46
|
|
|
71
|
-
|
|
72
|
-
def create_emails(template, num_emails=1)
|
|
47
|
+
emails = []
|
|
73
48
|
num_emails.times do
|
|
74
|
-
to = email_address_for_test
|
|
75
|
-
from = "test@test.com"
|
|
76
|
-
reply_to = "testGuy"
|
|
77
|
-
subject = "test subject"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
MailSpy.add_instance(
|
|
49
|
+
to = options[:to] || email_address_for_test
|
|
50
|
+
from = options[:from]|| "test@test.com"
|
|
51
|
+
reply_to = options[:reply_to] || "testGuy"
|
|
52
|
+
subject = options[:subject] || "test subject"
|
|
53
|
+
campaign = options[:campaign] || "test campaign"
|
|
54
|
+
stream = options[:stream] || "test stream"
|
|
55
|
+
component = options[:component] || "test component"
|
|
56
|
+
schedule_at = options[:schedule_at] || DateTime.now
|
|
57
|
+
|
|
58
|
+
emails << MailSpy.create_email(
|
|
85
59
|
:to => to,
|
|
86
60
|
:from => from,
|
|
87
61
|
:reply_to => reply_to,
|
|
88
62
|
:subject => subject,
|
|
89
|
-
:template_name => template_name,
|
|
90
63
|
:template_values => {},
|
|
91
64
|
:campaign => campaign,
|
|
92
65
|
:stream => stream,
|
|
@@ -94,6 +67,7 @@ class ActiveSupport::TestCase
|
|
|
94
67
|
:schedule_at => schedule_at
|
|
95
68
|
)
|
|
96
69
|
end
|
|
70
|
+
return emails
|
|
97
71
|
end
|
|
98
72
|
|
|
99
73
|
|
|
@@ -6,159 +6,138 @@ module MailSpy
|
|
|
6
6
|
assert true
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
def setup
|
|
10
|
-
MailSpy::
|
|
11
|
+
MailSpy::ProcessLog.delete_all
|
|
11
12
|
MailSpy::Email.delete_all
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
html_erb = "Hello World"
|
|
18
|
-
text_erb = "Hello World"
|
|
19
|
-
template_values_definition = {}
|
|
15
|
+
def teardown
|
|
16
|
+
MailSpy::ProcessLog.delete_all
|
|
17
|
+
end
|
|
20
18
|
|
|
21
|
-
template = MailSpy.add_template(template_name, html_erb, text_erb, template_values_definition)
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
# ------------------------------------------- CREATE EMAIL
|
|
21
|
+
def test_create_email
|
|
22
|
+
to = "test@test.com"
|
|
23
|
+
from = "test@test.com"
|
|
24
|
+
reply_to = "testGuy"
|
|
25
|
+
subject = "test subject"
|
|
26
|
+
campaign = "tests"
|
|
27
|
+
stream = "a-stream"
|
|
28
|
+
component = "a-helper_test"
|
|
29
|
+
schedule_at = DateTime.now
|
|
30
|
+
|
|
31
|
+
email = MailSpy.create_email(
|
|
32
|
+
:to => to,
|
|
33
|
+
:from => from,
|
|
34
|
+
:reply_to => reply_to,
|
|
35
|
+
:subject => subject,
|
|
36
|
+
:template_values => {},
|
|
37
|
+
:campaign => campaign,
|
|
38
|
+
:stream => stream,
|
|
39
|
+
:component => component,
|
|
40
|
+
:schedule_at => schedule_at
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
assert(email.to == to, "email subject must be set")
|
|
44
|
+
assert(email.subject == subject, "email subject must be set")
|
|
45
|
+
assert(email.campaign == campaign, "email campaign must be set")
|
|
46
|
+
assert(email.stream == stream, "email stream must be set")
|
|
47
|
+
assert(email.component == component, "email component must be set")
|
|
48
|
+
assert(email.schedule_at.to_i == schedule_at.to_i, "email schedule_at must be set")
|
|
27
49
|
end
|
|
28
50
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
schedule_at = DateTime.now
|
|
41
|
-
|
|
42
|
-
email = MailSpy.add_instance(
|
|
43
|
-
:to => to,
|
|
51
|
+
def test_missing_sender
|
|
52
|
+
from = "test@test.com"
|
|
53
|
+
reply_to = "testGuy"
|
|
54
|
+
subject = "test subject"
|
|
55
|
+
campaign = "tests"
|
|
56
|
+
stream = "a-stream"
|
|
57
|
+
component = "a-helper_test"
|
|
58
|
+
schedule_at = DateTime.now
|
|
59
|
+
|
|
60
|
+
assert_raise RuntimeError do
|
|
61
|
+
MailSpy.create_email(
|
|
44
62
|
:from => from,
|
|
45
63
|
:reply_to => reply_to,
|
|
46
64
|
:subject => subject,
|
|
47
|
-
:template_name => template_name,
|
|
48
65
|
:template_values => {},
|
|
49
66
|
:campaign => campaign,
|
|
50
67
|
:stream => stream,
|
|
51
68
|
:component => component,
|
|
52
69
|
:schedule_at => schedule_at
|
|
53
70
|
)
|
|
54
|
-
|
|
55
|
-
assert(email.to == to, "email subject must be set")
|
|
56
|
-
assert(email.subject == subject, "email subject must be set")
|
|
57
|
-
assert(email.template_name == template_name, "email template_name must be set")
|
|
58
|
-
assert(email.campaign == campaign, "email campaign must be set")
|
|
59
|
-
assert(email.stream == stream, "email stream must be set")
|
|
60
|
-
assert(email.component == component, "email component must be set")
|
|
61
|
-
assert(email.schedule_at.to_i == schedule_at.to_i, "email schedule_at must be set")
|
|
62
71
|
end
|
|
63
72
|
end
|
|
64
73
|
|
|
65
|
-
def
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
:schedule_at => schedule_at
|
|
87
|
-
)
|
|
88
|
-
end
|
|
74
|
+
def test_missing_required_field
|
|
75
|
+
|
|
76
|
+
to = "test@test.com"
|
|
77
|
+
from = "test@test.com"
|
|
78
|
+
reply_to = "testGuy"
|
|
79
|
+
campaign = "tests"
|
|
80
|
+
stream = "a-stream"
|
|
81
|
+
component = "a-helper_test"
|
|
82
|
+
schedule_at = DateTime.now
|
|
83
|
+
|
|
84
|
+
assert_raise RuntimeError do
|
|
85
|
+
MailSpy.create_email(
|
|
86
|
+
:to => to,
|
|
87
|
+
:from => from,
|
|
88
|
+
:reply_to => reply_to,
|
|
89
|
+
:template_values => {},
|
|
90
|
+
:campaign => campaign,
|
|
91
|
+
:stream => stream,
|
|
92
|
+
:component => component,
|
|
93
|
+
:schedule_at => schedule_at
|
|
94
|
+
)
|
|
89
95
|
end
|
|
90
96
|
end
|
|
91
97
|
|
|
92
|
-
def test_missing_required_field
|
|
93
98
|
|
|
94
|
-
do_with_template do |template|
|
|
95
|
-
to = "test@test.com"
|
|
96
|
-
from = "test@test.com"
|
|
97
|
-
reply_to = "testGuy"
|
|
98
|
-
template_name = template.name
|
|
99
|
-
campaign = "test campaign"
|
|
100
|
-
stream = "test stream"
|
|
101
|
-
component = "test component"
|
|
102
|
-
schedule_at = DateTime.now
|
|
103
|
-
|
|
104
|
-
assert_raise RuntimeError do
|
|
105
|
-
MailSpy.add_instance(
|
|
106
|
-
:to => to,
|
|
107
|
-
:from => from,
|
|
108
|
-
:reply_to => reply_to,
|
|
109
|
-
:template_name => template_name,
|
|
110
|
-
:template_values => {},
|
|
111
|
-
:campaign => campaign,
|
|
112
|
-
:stream => stream,
|
|
113
|
-
:component => component,
|
|
114
|
-
:schedule_at => schedule_at
|
|
115
|
-
)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
99
|
|
|
100
|
+
def test_referencing_missing_template
|
|
101
|
+
to = "test@test.com"
|
|
102
|
+
from = "test@test.com"
|
|
103
|
+
reply_to = "testGuy"
|
|
104
|
+
subject = "test subject"
|
|
105
|
+
campaign = "NO SUCH CAMPAIGN"
|
|
106
|
+
stream = "NO SUCH STREAM"
|
|
107
|
+
component = "NO SUCH COMPONENT"
|
|
108
|
+
schedule_at = DateTime.now
|
|
109
|
+
|
|
110
|
+
assert_raise RuntimeError do
|
|
111
|
+
MailSpy.create_email(
|
|
112
|
+
:to => to,
|
|
113
|
+
:subject => subject,
|
|
114
|
+
:from => from,
|
|
115
|
+
:reply_to => reply_to,
|
|
116
|
+
:template_values => {},
|
|
117
|
+
:campaign => campaign,
|
|
118
|
+
:stream => stream,
|
|
119
|
+
:component => component,
|
|
120
|
+
:schedule_at => schedule_at
|
|
121
|
+
)
|
|
119
122
|
end
|
|
123
|
+
end
|
|
120
124
|
|
|
121
|
-
|
|
122
|
-
do_with_template do |template|
|
|
123
|
-
to = "test@test.com"
|
|
124
|
-
from = "test@test.com"
|
|
125
|
-
reply_to = "testGuy"
|
|
126
|
-
subject = "test subject"
|
|
127
|
-
campaign = "test campaign"
|
|
128
|
-
stream = "test stream"
|
|
129
|
-
component = "test component"
|
|
130
|
-
schedule_at = DateTime.now
|
|
131
|
-
|
|
132
|
-
assert_raise RuntimeError do
|
|
133
|
-
MailSpy.add_instance(
|
|
134
|
-
:to => to,
|
|
135
|
-
:subject => subject,
|
|
136
|
-
:from => from,
|
|
137
|
-
:reply_to => reply_to,
|
|
138
|
-
:template_name => "NOT HERE",
|
|
139
|
-
:template_values => {},
|
|
140
|
-
:campaign => campaign,
|
|
141
|
-
:stream => stream,
|
|
142
|
-
:component => component,
|
|
143
|
-
:schedule_at => schedule_at
|
|
144
|
-
)
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
end
|
|
125
|
+
# ------------------------------------------- SEND_OUTSTANDING_EMAILS
|
|
148
126
|
|
|
149
|
-
# ------------------------------------------- SEND_OUTSTANDING_EMAILS
|
|
150
127
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
initialize_mail_spy_test_esp
|
|
128
|
+
def test_send_outstanding_emails
|
|
129
|
+
create_emails(:campaign => "tests", :stream => "a-stream", :component => "a-helper_test")
|
|
154
130
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
131
|
+
num_sent = MailSpy.send_outstanding_emails
|
|
132
|
+
process_log = MailSpy::ProcessLog.first
|
|
133
|
+
assert(num_sent == 1, "We should have sent a email")
|
|
134
|
+
|
|
135
|
+
assert(process_log.success, "process should have been successful")
|
|
136
|
+
assert(!process_log.running, "process should have finished")
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
#TODO need to document the testing methods for setting up the test_email
|
|
158
140
|
|
|
159
|
-
num_sent = MailSpy.send_outstanding_emails
|
|
160
|
-
assert(num_sent == 1, "We should have sent a email")
|
|
161
|
-
end
|
|
162
141
|
|
|
163
142
|
end
|
|
164
143
|
end
|