mail_spy 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/mail_spy/email.rb +48 -0
- data/app/models/mail_spy/process_log.rb +25 -0
- data/lib/mail_spy/manager.rb +35 -9
- data/lib/mail_spy/version.rb +1 -1
- data/test/dummy/db/seeds.rb +16 -13
- data/test/dummy/log/development.log +724 -0
- data/test/dummy/log/test.log +2372 -0
- data/test/fixtures/mail_spy/process_logs.yml +15 -0
- data/test/functional/mail_spy/tracking_controller_test.rb +13 -1
- data/test/unit/mail_spy/manager_test.rb +25 -12
- data/test/unit/mail_spy/process_log_test.rb +9 -0
- metadata +7 -2
@@ -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
|
@@ -26,7 +26,19 @@ module MailSpy
|
|
26
26
|
|
27
27
|
get "link", params
|
28
28
|
|
29
|
-
|
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
|
30
42
|
|
31
43
|
email = @email.reload
|
32
44
|
details = email.actions.first.details
|
@@ -6,10 +6,16 @@ module MailSpy
|
|
6
6
|
assert true
|
7
7
|
end
|
8
8
|
|
9
|
+
|
9
10
|
def setup
|
11
|
+
MailSpy::ProcessLog.delete_all
|
10
12
|
MailSpy::Email.delete_all
|
11
13
|
end
|
12
14
|
|
15
|
+
def teardown
|
16
|
+
MailSpy::ProcessLog.delete_all
|
17
|
+
end
|
18
|
+
|
13
19
|
|
14
20
|
# ------------------------------------------- CREATE EMAIL
|
15
21
|
def test_create_email
|
@@ -17,9 +23,9 @@ module MailSpy
|
|
17
23
|
from = "test@test.com"
|
18
24
|
reply_to = "testGuy"
|
19
25
|
subject = "test subject"
|
20
|
-
campaign = "
|
21
|
-
stream = "
|
22
|
-
component = "
|
26
|
+
campaign = "tests"
|
27
|
+
stream = "a-stream"
|
28
|
+
component = "a-helper_test"
|
23
29
|
schedule_at = DateTime.now
|
24
30
|
|
25
31
|
email = MailSpy.create_email(
|
@@ -46,9 +52,9 @@ module MailSpy
|
|
46
52
|
from = "test@test.com"
|
47
53
|
reply_to = "testGuy"
|
48
54
|
subject = "test subject"
|
49
|
-
campaign = "
|
50
|
-
stream = "
|
51
|
-
component = "
|
55
|
+
campaign = "tests"
|
56
|
+
stream = "a-stream"
|
57
|
+
component = "a-helper_test"
|
52
58
|
schedule_at = DateTime.now
|
53
59
|
|
54
60
|
assert_raise RuntimeError do
|
@@ -70,9 +76,9 @@ module MailSpy
|
|
70
76
|
to = "test@test.com"
|
71
77
|
from = "test@test.com"
|
72
78
|
reply_to = "testGuy"
|
73
|
-
campaign = "
|
74
|
-
stream = "
|
75
|
-
component = "
|
79
|
+
campaign = "tests"
|
80
|
+
stream = "a-stream"
|
81
|
+
component = "a-helper_test"
|
76
82
|
schedule_at = DateTime.now
|
77
83
|
|
78
84
|
assert_raise RuntimeError do
|
@@ -89,7 +95,7 @@ module MailSpy
|
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
92
|
-
|
98
|
+
|
93
99
|
|
94
100
|
def test_referencing_missing_template
|
95
101
|
to = "test@test.com"
|
@@ -118,13 +124,20 @@ module MailSpy
|
|
118
124
|
|
119
125
|
# ------------------------------------------- SEND_OUTSTANDING_EMAILS
|
120
126
|
|
121
|
-
|
127
|
+
|
122
128
|
def test_send_outstanding_emails
|
123
129
|
create_emails(:campaign => "tests", :stream => "a-stream", :component => "a-helper_test")
|
124
130
|
|
125
|
-
|
126
131
|
num_sent = MailSpy.send_outstanding_emails
|
132
|
+
process_log = MailSpy::ProcessLog.first
|
127
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")
|
128
137
|
end
|
129
138
|
|
139
|
+
#TODO need to document the testing methods for setting up the test_email
|
140
|
+
|
141
|
+
|
142
|
+
end
|
130
143
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mail_spy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.17
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Timothy Cardenas
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-02-
|
13
|
+
date: 2012-02-07 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- app/models/mail_spy/campaign_report.rb
|
228
228
|
- app/models/mail_spy/component_report.rb
|
229
229
|
- app/models/mail_spy/email.rb
|
230
|
+
- app/models/mail_spy/process_log.rb
|
230
231
|
- app/models/mail_spy/stream_report.rb
|
231
232
|
- app/views/layouts/mail_spy/application.html.erb
|
232
233
|
- app/views/mail_spy/reports/campaigns.html.erb
|
@@ -284,6 +285,7 @@ files:
|
|
284
285
|
- test/fixtures/mail_spy/campaign_reports.yml
|
285
286
|
- test/fixtures/mail_spy/component_reports.yml
|
286
287
|
- test/fixtures/mail_spy/emails.yml
|
288
|
+
- test/fixtures/mail_spy/process_logs.yml
|
287
289
|
- test/fixtures/mail_spy/stream_reports.yml
|
288
290
|
- test/functional/mail_spy/core_mailer_test.rb
|
289
291
|
- test/functional/mail_spy/sendgrid_controller_test.rb
|
@@ -300,6 +302,7 @@ files:
|
|
300
302
|
- test/unit/mail_spy/component_report_test.rb
|
301
303
|
- test/unit/mail_spy/email_test.rb
|
302
304
|
- test/unit/mail_spy/manager_test.rb
|
305
|
+
- test/unit/mail_spy/process_log_test.rb
|
303
306
|
- test/unit/mail_spy/stream_report_test.rb
|
304
307
|
homepage: http://timcardenas.com
|
305
308
|
licenses: []
|
@@ -371,6 +374,7 @@ test_files:
|
|
371
374
|
- test/fixtures/mail_spy/campaign_reports.yml
|
372
375
|
- test/fixtures/mail_spy/component_reports.yml
|
373
376
|
- test/fixtures/mail_spy/emails.yml
|
377
|
+
- test/fixtures/mail_spy/process_logs.yml
|
374
378
|
- test/fixtures/mail_spy/stream_reports.yml
|
375
379
|
- test/functional/mail_spy/core_mailer_test.rb
|
376
380
|
- test/functional/mail_spy/sendgrid_controller_test.rb
|
@@ -387,4 +391,5 @@ test_files:
|
|
387
391
|
- test/unit/mail_spy/component_report_test.rb
|
388
392
|
- test/unit/mail_spy/email_test.rb
|
389
393
|
- test/unit/mail_spy/manager_test.rb
|
394
|
+
- test/unit/mail_spy/process_log_test.rb
|
390
395
|
- test/unit/mail_spy/stream_report_test.rb
|