email_spec 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Changelog.md +4 -0
- data/README.md +5 -2
- data/lib/email_spec/deliveries.rb +12 -5
- data/lib/email_spec/mail_ext.rb +2 -2
- data/lib/email_spec/version.rb +1 -1
- data/spec/email_spec/mail_ext_spec.rb +8 -0
- data/spec/spec_helper.rb +3 -0
- metadata +6 -14
- data/examples/rails4_root/Gemfile.lock +0 -199
- data/examples/rails4_root/db/test.sqlite3 +0 -0
- data/examples/rails4_root/features/step_definitions/email_steps.rb +0 -226
- data/examples/rails4_root/log/development.log +0 -0
- data/examples/rails4_root/log/test.log +0 -1498
- data/examples/sinatra_root/Gemfile.lock +0 -107
- data/examples/sinatra_root/features/step_definitions/email_steps.rb +0 -226
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 11bdd9e521aecbb968f672214cc109869f111f1ac981b793e1a3c41bcf4691ce
|
4
|
+
data.tar.gz: 7cd61105485eae764f8786ef4a3e2ccdbd9309f8d020f883177d8d62df7df184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 540ed6ea489564623c0ab0c781c70842782b8485307cf70d7396fc0221896ac396cae83a58d72e64586bb879b58a68b3e93b61f24120586657fe9acaea9f9486
|
7
|
+
data.tar.gz: 57b37098385ff0d8f545e385195693ddf67c04d03d4c37a9219cf4677d36cc2a880e0dea6bca6eed595ac977eb9afd1841062d180e47410ce5ec6fe20c1820fd
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
[![Build Status](https://secure.travis-ci.org/email-spec/email-spec.png)](http://travis-ci.org/email-spec/email-spec)
|
1
|
+
[![Build Status](https://secure.travis-ci.org/email-spec/email-spec.svg)](http://travis-ci.org/email-spec/email-spec)
|
3
2
|
|
4
3
|
## Email Spec
|
5
4
|
|
@@ -339,6 +338,10 @@ email = UserMailer.create_signup "jojo@yahoo.com", "Jojo Binks"
|
|
339
338
|
assert_must deliver_to("jojo@yahoo.com"), email
|
340
339
|
```
|
341
340
|
|
341
|
+
## Issue triage [![Open Source Helpers](https://www.codetriage.com/email-spec/email-spec/badges/users.svg)](https://www.codetriage.com/email-spec/email-spec)
|
342
|
+
|
343
|
+
You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to email-spec on CodeTriage](https://www.codetriage.com/email-spec/email-spec).
|
344
|
+
|
342
345
|
## Original Authors
|
343
346
|
|
344
347
|
Ben Mabey, Aaron Gibralter, Mischa Fierer
|
@@ -73,12 +73,19 @@ module EmailSpec
|
|
73
73
|
if defined?(Pony)
|
74
74
|
def deliveries; Pony::deliveries ; end
|
75
75
|
include EmailSpec::MailerDeliveries
|
76
|
-
elsif ActionMailer::Base.delivery_method == :activerecord
|
77
|
-
include EmailSpec::ARMailerDeliveries
|
78
76
|
else
|
79
|
-
|
80
|
-
|
77
|
+
ActiveSupport.on_load(:action_mailer) do
|
78
|
+
if delivery_method == :activerecord
|
79
|
+
::EmailSpec::Helpers.include EmailSpec::ARMailerDeliveries
|
80
|
+
else
|
81
|
+
::EmailSpec::Deliveries.module_eval do
|
82
|
+
def mailer
|
83
|
+
ActionMailer::Base
|
84
|
+
end
|
85
|
+
end
|
86
|
+
::EmailSpec::Helpers.include ::EmailSpec::MailerDeliveries
|
87
|
+
end
|
88
|
+
end
|
81
89
|
end
|
82
90
|
end
|
83
91
|
end
|
84
|
-
|
data/lib/email_spec/mail_ext.rb
CHANGED
@@ -5,11 +5,11 @@ module EmailSpec::MailExt
|
|
5
5
|
|
6
6
|
def default_part_body
|
7
7
|
# Calling to_str as we want the actual String object
|
8
|
-
HTMLEntities.new.decode(default_part.
|
8
|
+
HTMLEntities.new.decode(default_part.decoded.to_s.to_str)
|
9
9
|
end
|
10
10
|
|
11
11
|
def html
|
12
|
-
html_part ? html_part.
|
12
|
+
html_part ? html_part.decoded : nil
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/lib/email_spec/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'active_support'
|
2
3
|
|
3
4
|
describe EmailSpec::MailExt do
|
4
5
|
describe "#default_part" do
|
@@ -35,6 +36,13 @@ describe EmailSpec::MailExt do
|
|
35
36
|
email = Mail.new(:body => ActiveSupport::SafeBuffer.new("bacon & pancake"))
|
36
37
|
expect(email.default_part_body).to eq ("bacon & pancake")
|
37
38
|
end
|
39
|
+
|
40
|
+
it "decodes parts before return" do
|
41
|
+
email = Mail.new(:body => "hello\r\nquoted-printable")
|
42
|
+
email.content_transfer_encoding = 'quoted-printable'
|
43
|
+
expect(email.encoded).to include("hello=0D\nquoted-printable")
|
44
|
+
expect(email.default_part_body).to eq("hello\r\nquoted-printable")
|
45
|
+
end
|
38
46
|
end
|
39
47
|
|
40
48
|
describe "#html" do
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,9 @@ require 'action_mailer'
|
|
3
3
|
require 'mail'
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/email_spec.rb')
|
5
5
|
|
6
|
+
# Trigger loading ActionMailer::Base
|
7
|
+
ActionMailer::Base
|
8
|
+
|
6
9
|
RSpec.configure do |config|
|
7
10
|
config.include EmailSpec::Helpers
|
8
11
|
config.include EmailSpec::Matchers
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabey
|
8
8
|
- Aaron Gibralter
|
9
9
|
- Mischa Fierer
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: htmlentities
|
@@ -179,7 +179,6 @@ files:
|
|
179
179
|
- README.md
|
180
180
|
- Rakefile
|
181
181
|
- examples/rails4_root/Gemfile
|
182
|
-
- examples/rails4_root/Gemfile.lock
|
183
182
|
- examples/rails4_root/README
|
184
183
|
- examples/rails4_root/Rakefile
|
185
184
|
- examples/rails4_root/app/controllers/application_controller.rb
|
@@ -223,13 +222,11 @@ files:
|
|
223
222
|
- examples/rails4_root/db/migrate/20141119224309_add_queue_to_delayed_jobs.rb
|
224
223
|
- examples/rails4_root/db/schema.rb
|
225
224
|
- examples/rails4_root/db/seeds.rb
|
226
|
-
- examples/rails4_root/db/test.sqlite3
|
227
225
|
- examples/rails4_root/doc/README_FOR_APP
|
228
226
|
- examples/rails4_root/features/attachments.feature
|
229
227
|
- examples/rails4_root/features/delayed_job.feature
|
230
228
|
- examples/rails4_root/features/errors.feature
|
231
229
|
- examples/rails4_root/features/example.feature
|
232
|
-
- examples/rails4_root/features/step_definitions/email_steps.rb
|
233
230
|
- examples/rails4_root/features/step_definitions/user_steps.rb
|
234
231
|
- examples/rails4_root/features/step_definitions/web_steps.rb
|
235
232
|
- examples/rails4_root/features/support/env.rb
|
@@ -238,8 +235,6 @@ files:
|
|
238
235
|
- examples/rails4_root/lib/notifier_job.rb
|
239
236
|
- examples/rails4_root/lib/tasks/cucumber.rake
|
240
237
|
- examples/rails4_root/lib/tasks/rspec.rake
|
241
|
-
- examples/rails4_root/log/development.log
|
242
|
-
- examples/rails4_root/log/test.log
|
243
238
|
- examples/rails4_root/public/404.html
|
244
239
|
- examples/rails4_root/public/422.html
|
245
240
|
- examples/rails4_root/public/500.html
|
@@ -262,11 +257,9 @@ files:
|
|
262
257
|
- examples/rails4_root/test/mailers/user_mailer_spec_test.rb
|
263
258
|
- examples/rails4_root/test/test_helper.rb
|
264
259
|
- examples/sinatra_root/Gemfile
|
265
|
-
- examples/sinatra_root/Gemfile.lock
|
266
260
|
- examples/sinatra_root/config.ru
|
267
261
|
- examples/sinatra_root/features/errors.feature
|
268
262
|
- examples/sinatra_root/features/example.feature
|
269
|
-
- examples/sinatra_root/features/step_definitions/email_steps.rb
|
270
263
|
- examples/sinatra_root/features/step_definitions/user_steps.rb
|
271
264
|
- examples/sinatra_root/features/step_definitions/web_steps.rb
|
272
265
|
- examples/sinatra_root/features/support/env.rb
|
@@ -301,7 +294,7 @@ homepage: http://github.com/email-spec/email-spec/
|
|
301
294
|
licenses:
|
302
295
|
- MIT
|
303
296
|
metadata: {}
|
304
|
-
post_install_message:
|
297
|
+
post_install_message:
|
305
298
|
rdoc_options: []
|
306
299
|
require_paths:
|
307
300
|
- lib
|
@@ -316,9 +309,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
309
|
- !ruby/object:Gem::Version
|
317
310
|
version: '0'
|
318
311
|
requirements: []
|
319
|
-
|
320
|
-
|
321
|
-
signing_key:
|
312
|
+
rubygems_version: 3.3.21
|
313
|
+
signing_key:
|
322
314
|
specification_version: 4
|
323
315
|
summary: Easily test email in RSpec, Cucumber or Minitest
|
324
316
|
test_files: []
|
@@ -1,199 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../..
|
3
|
-
specs:
|
4
|
-
email_spec (2.1.2)
|
5
|
-
htmlentities (~> 4.3.3)
|
6
|
-
launchy (~> 2.1)
|
7
|
-
mail (~> 2.7)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actionmailer (4.2.8)
|
13
|
-
actionpack (= 4.2.8)
|
14
|
-
actionview (= 4.2.8)
|
15
|
-
activejob (= 4.2.8)
|
16
|
-
mail (~> 2.5, >= 2.5.4)
|
17
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
-
actionpack (4.2.8)
|
19
|
-
actionview (= 4.2.8)
|
20
|
-
activesupport (= 4.2.8)
|
21
|
-
rack (~> 1.6)
|
22
|
-
rack-test (~> 0.6.2)
|
23
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
-
actionview (4.2.8)
|
26
|
-
activesupport (= 4.2.8)
|
27
|
-
builder (~> 3.1)
|
28
|
-
erubis (~> 2.7.0)
|
29
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
31
|
-
activejob (4.2.8)
|
32
|
-
activesupport (= 4.2.8)
|
33
|
-
globalid (>= 0.3.0)
|
34
|
-
activemodel (4.2.8)
|
35
|
-
activesupport (= 4.2.8)
|
36
|
-
builder (~> 3.1)
|
37
|
-
activerecord (4.2.8)
|
38
|
-
activemodel (= 4.2.8)
|
39
|
-
activesupport (= 4.2.8)
|
40
|
-
arel (~> 6.0)
|
41
|
-
activesupport (4.2.8)
|
42
|
-
i18n (~> 0.7)
|
43
|
-
minitest (~> 5.1)
|
44
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
45
|
-
tzinfo (~> 1.1)
|
46
|
-
addressable (2.5.2)
|
47
|
-
public_suffix (>= 2.0.2, < 4.0)
|
48
|
-
arel (6.0.4)
|
49
|
-
backports (3.11.1)
|
50
|
-
builder (3.2.3)
|
51
|
-
capybara (2.18.0)
|
52
|
-
addressable
|
53
|
-
mini_mime (>= 0.1.3)
|
54
|
-
nokogiri (>= 1.3.3)
|
55
|
-
rack (>= 1.0.0)
|
56
|
-
rack-test (>= 0.5.4)
|
57
|
-
xpath (>= 2.0, < 4.0)
|
58
|
-
concurrent-ruby (1.0.5)
|
59
|
-
crass (1.0.3)
|
60
|
-
cucumber (3.1.0)
|
61
|
-
builder (>= 2.1.2)
|
62
|
-
cucumber-core (~> 3.1.0)
|
63
|
-
cucumber-expressions (~> 5.0.4)
|
64
|
-
cucumber-wire (~> 0.0.1)
|
65
|
-
diff-lcs (~> 1.3)
|
66
|
-
gherkin (~> 5.0)
|
67
|
-
multi_json (>= 1.7.5, < 2.0)
|
68
|
-
multi_test (>= 0.1.2)
|
69
|
-
cucumber-core (3.1.0)
|
70
|
-
backports (>= 3.8.0)
|
71
|
-
cucumber-tag_expressions (~> 1.1.0)
|
72
|
-
gherkin (>= 5.0.0)
|
73
|
-
cucumber-expressions (5.0.13)
|
74
|
-
cucumber-rails (1.5.0)
|
75
|
-
capybara (>= 1.1.2, < 3)
|
76
|
-
cucumber (>= 1.3.8, < 4)
|
77
|
-
mime-types (>= 1.17, < 4)
|
78
|
-
nokogiri (~> 1.5)
|
79
|
-
railties (>= 4, < 5.2)
|
80
|
-
cucumber-tag_expressions (1.1.1)
|
81
|
-
cucumber-wire (0.0.1)
|
82
|
-
database_cleaner (1.6.2)
|
83
|
-
delayed_job (4.0.6)
|
84
|
-
activesupport (>= 3.0, < 5.0)
|
85
|
-
delayed_job_active_record (4.1.2)
|
86
|
-
activerecord (>= 3.0, < 5.2)
|
87
|
-
delayed_job (>= 3.0, < 5)
|
88
|
-
diff-lcs (1.3)
|
89
|
-
erubis (2.7.0)
|
90
|
-
gherkin (5.0.0)
|
91
|
-
globalid (0.4.1)
|
92
|
-
activesupport (>= 4.2.0)
|
93
|
-
htmlentities (4.3.4)
|
94
|
-
i18n (0.9.5)
|
95
|
-
concurrent-ruby (~> 1.0)
|
96
|
-
launchy (2.4.3)
|
97
|
-
addressable (~> 2.3)
|
98
|
-
loofah (2.2.2)
|
99
|
-
crass (~> 1.0.2)
|
100
|
-
nokogiri (>= 1.5.9)
|
101
|
-
mail (2.7.0)
|
102
|
-
mini_mime (>= 0.1.1)
|
103
|
-
mime-types (3.1)
|
104
|
-
mime-types-data (~> 3.2015)
|
105
|
-
mime-types-data (3.2016.0521)
|
106
|
-
mimetype-fu (0.1.2)
|
107
|
-
mini_mime (1.0.0)
|
108
|
-
mini_portile2 (2.3.0)
|
109
|
-
minitest (5.11.3)
|
110
|
-
minitest-matchers (1.4.1)
|
111
|
-
minitest (~> 5.0)
|
112
|
-
minitest-rails (2.2.1)
|
113
|
-
minitest (~> 5.7)
|
114
|
-
railties (~> 4.1)
|
115
|
-
multi_json (1.13.1)
|
116
|
-
multi_test (0.1.2)
|
117
|
-
nokogiri (1.8.2)
|
118
|
-
mini_portile2 (~> 2.3.0)
|
119
|
-
public_suffix (3.0.2)
|
120
|
-
rack (1.6.9)
|
121
|
-
rack-test (0.6.3)
|
122
|
-
rack (>= 1.0)
|
123
|
-
rails (4.2.8)
|
124
|
-
actionmailer (= 4.2.8)
|
125
|
-
actionpack (= 4.2.8)
|
126
|
-
actionview (= 4.2.8)
|
127
|
-
activejob (= 4.2.8)
|
128
|
-
activemodel (= 4.2.8)
|
129
|
-
activerecord (= 4.2.8)
|
130
|
-
activesupport (= 4.2.8)
|
131
|
-
bundler (>= 1.3.0, < 2.0)
|
132
|
-
railties (= 4.2.8)
|
133
|
-
sprockets-rails
|
134
|
-
rails-deprecated_sanitizer (1.0.3)
|
135
|
-
activesupport (>= 4.2.0.alpha)
|
136
|
-
rails-dom-testing (1.0.9)
|
137
|
-
activesupport (>= 4.2.0, < 5.0)
|
138
|
-
nokogiri (~> 1.6)
|
139
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
140
|
-
rails-html-sanitizer (1.0.4)
|
141
|
-
loofah (~> 2.2, >= 2.2.2)
|
142
|
-
railties (4.2.8)
|
143
|
-
actionpack (= 4.2.8)
|
144
|
-
activesupport (= 4.2.8)
|
145
|
-
rake (>= 0.8.7)
|
146
|
-
thor (>= 0.18.1, < 2.0)
|
147
|
-
rake (10.3.2)
|
148
|
-
rspec-core (3.7.1)
|
149
|
-
rspec-support (~> 3.7.0)
|
150
|
-
rspec-expectations (3.7.0)
|
151
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
-
rspec-support (~> 3.7.0)
|
153
|
-
rspec-mocks (3.7.0)
|
154
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
155
|
-
rspec-support (~> 3.7.0)
|
156
|
-
rspec-rails (3.7.2)
|
157
|
-
actionpack (>= 3.0)
|
158
|
-
activesupport (>= 3.0)
|
159
|
-
railties (>= 3.0)
|
160
|
-
rspec-core (~> 3.7.0)
|
161
|
-
rspec-expectations (~> 3.7.0)
|
162
|
-
rspec-mocks (~> 3.7.0)
|
163
|
-
rspec-support (~> 3.7.0)
|
164
|
-
rspec-support (3.7.1)
|
165
|
-
sprockets (3.7.1)
|
166
|
-
concurrent-ruby (~> 1.0)
|
167
|
-
rack (> 1, < 3)
|
168
|
-
sprockets-rails (3.2.1)
|
169
|
-
actionpack (>= 4.0)
|
170
|
-
activesupport (>= 4.0)
|
171
|
-
sprockets (>= 3.0.0)
|
172
|
-
sqlite3 (1.3.13)
|
173
|
-
thor (0.20.0)
|
174
|
-
thread_safe (0.3.6)
|
175
|
-
tzinfo (1.2.5)
|
176
|
-
thread_safe (~> 0.1)
|
177
|
-
xpath (3.0.0)
|
178
|
-
nokogiri (~> 1.8)
|
179
|
-
|
180
|
-
PLATFORMS
|
181
|
-
ruby
|
182
|
-
|
183
|
-
DEPENDENCIES
|
184
|
-
capybara
|
185
|
-
cucumber-rails
|
186
|
-
database_cleaner
|
187
|
-
delayed_job (~> 4.0.6)
|
188
|
-
delayed_job_active_record
|
189
|
-
email_spec!
|
190
|
-
mimetype-fu
|
191
|
-
minitest-matchers
|
192
|
-
minitest-rails
|
193
|
-
rails (= 4.2.8)
|
194
|
-
rake (~> 10.3.2)
|
195
|
-
rspec-rails
|
196
|
-
sqlite3
|
197
|
-
|
198
|
-
BUNDLED WITH
|
199
|
-
1.16.1
|
Binary file
|
@@ -1,226 +0,0 @@
|
|
1
|
-
# Commonly used email steps
|
2
|
-
#
|
3
|
-
# To add your own steps make a custom_email_steps.rb
|
4
|
-
# The provided methods are:
|
5
|
-
#
|
6
|
-
# last_email_address
|
7
|
-
# reset_mailer
|
8
|
-
# open_last_email
|
9
|
-
# visit_in_email
|
10
|
-
# unread_emails_for
|
11
|
-
# mailbox_for
|
12
|
-
# current_email
|
13
|
-
# open_email
|
14
|
-
# read_emails_for
|
15
|
-
# find_email
|
16
|
-
#
|
17
|
-
# General form for email scenarios are:
|
18
|
-
# - clear the email queue (done automatically by email_spec)
|
19
|
-
# - execute steps that sends an email
|
20
|
-
# - check the user received an/no/[0-9] emails
|
21
|
-
# - open the email
|
22
|
-
# - inspect the email contents
|
23
|
-
# - interact with the email (e.g. click links)
|
24
|
-
#
|
25
|
-
# The Cucumber steps below are setup in this order.
|
26
|
-
|
27
|
-
module EmailHelpers
|
28
|
-
def current_email_address
|
29
|
-
# Replace with your a way to find your current email. e.g @current_user.email
|
30
|
-
# last_email_address will return the last email address used by email spec to find an email.
|
31
|
-
# Note that last_email_address will be reset after each Scenario.
|
32
|
-
last_email_address || "example@example.com"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
World(EmailHelpers)
|
37
|
-
|
38
|
-
#
|
39
|
-
# Reset the e-mail queue within a scenario.
|
40
|
-
# This is done automatically before each scenario.
|
41
|
-
#
|
42
|
-
|
43
|
-
Given /^(?:a clear email queue|no emails have been sent)$/ do
|
44
|
-
reset_mailer
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# Check how many emails have been sent/received
|
49
|
-
#
|
50
|
-
|
51
|
-
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
|
52
|
-
expect(unread_emails_for(address).size).to eql parse_email_count(amount)
|
53
|
-
end
|
54
|
-
|
55
|
-
Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount|
|
56
|
-
expect(mailbox_for(address).size).to eql parse_email_count(amount)
|
57
|
-
end
|
58
|
-
|
59
|
-
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
|
60
|
-
expect(unread_emails_for(address).select { |m| m.subject =~ Regexp.new(Regexp.escape(subject)) }.size).to eql parse_email_count(amount)
|
61
|
-
end
|
62
|
-
|
63
|
-
Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject \/([^"]*?)\/$/ do |address, amount, subject|
|
64
|
-
expect(unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size).to eql parse_email_count(amount)
|
65
|
-
end
|
66
|
-
|
67
|
-
Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
|
68
|
-
open_email(address, :with_text => expected_body)
|
69
|
-
end
|
70
|
-
|
71
|
-
#
|
72
|
-
# Accessing emails
|
73
|
-
#
|
74
|
-
|
75
|
-
# Opens the most recently received email
|
76
|
-
When /^(?:I|they|"([^"]*?)") opens? the email$/ do |address|
|
77
|
-
open_email(address)
|
78
|
-
end
|
79
|
-
|
80
|
-
When /^(?:I|they|"([^"]*?)") opens? the email with subject "([^"]*?)"$/ do |address, subject|
|
81
|
-
open_email(address, :with_subject => subject)
|
82
|
-
end
|
83
|
-
|
84
|
-
When /^(?:I|they|"([^"]*?)") opens? the email with subject \/([^"]*?)\/$/ do |address, subject|
|
85
|
-
open_email(address, :with_subject => Regexp.new(subject))
|
86
|
-
end
|
87
|
-
|
88
|
-
When /^(?:I|they|"([^"]*?)") opens? the email with text "([^"]*?)"$/ do |address, text|
|
89
|
-
open_email(address, :with_text => text)
|
90
|
-
end
|
91
|
-
|
92
|
-
When /^(?:I|they|"([^"]*?)") opens? the email with text \/([^"]*?)\/$/ do |address, text|
|
93
|
-
open_email(address, :with_text => Regexp.new(text))
|
94
|
-
end
|
95
|
-
|
96
|
-
#
|
97
|
-
# Inspect the Email Contents
|
98
|
-
#
|
99
|
-
|
100
|
-
Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text|
|
101
|
-
expect(current_email).to have_subject(text)
|
102
|
-
end
|
103
|
-
|
104
|
-
Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
|
105
|
-
expect(current_email).to have_subject(Regexp.new(text))
|
106
|
-
end
|
107
|
-
|
108
|
-
Then /^(?:I|they) should not see "([^"]*?)" in the email subject$/ do |text|
|
109
|
-
expect(current_email).not_to have_subject(text)
|
110
|
-
end
|
111
|
-
|
112
|
-
Then /^(?:I|they) should not see \/([^"]*?)\/ in the email subject$/ do |text|
|
113
|
-
expect(current_email).not_to have_subject(Regexp.new(text))
|
114
|
-
end
|
115
|
-
|
116
|
-
Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
|
117
|
-
expect(current_email.default_part_body.to_s).to include(text)
|
118
|
-
end
|
119
|
-
|
120
|
-
Then /^(?:I|they) should not see "([^"]*?)" in the email body$/ do |text|
|
121
|
-
expect(current_email.default_part_body.to_s).not_to include(text)
|
122
|
-
end
|
123
|
-
|
124
|
-
Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text|
|
125
|
-
expect(current_email.default_part_body.to_s).to match Regexp.new(text)
|
126
|
-
end
|
127
|
-
|
128
|
-
Then /^(?:I|they) should not see \/([^"]*?)\/ in the email body$/ do |text|
|
129
|
-
expect(current_email.default_part_body.to_s).not_to match Regexp.new(text)
|
130
|
-
end
|
131
|
-
|
132
|
-
Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text|
|
133
|
-
expect(current_email).to be_delivered_from(text)
|
134
|
-
end
|
135
|
-
|
136
|
-
Then /^(?:I|they) should see the email reply to "([^"]*?)"$/ do |text|
|
137
|
-
expect(current_email).to have_reply_to(text)
|
138
|
-
end
|
139
|
-
|
140
|
-
Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name|
|
141
|
-
expect(current_email).to have_header(name, text)
|
142
|
-
end
|
143
|
-
|
144
|
-
Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name|
|
145
|
-
expect(current_email).to have_header(name, Regexp.new(text))
|
146
|
-
end
|
147
|
-
|
148
|
-
Then /^I should see it is a multi\-part email$/ do
|
149
|
-
expect(current_email).to be_multipart
|
150
|
-
end
|
151
|
-
|
152
|
-
Then /^(?:I|they) should see "([^"]*?)" in the email html part body$/ do |text|
|
153
|
-
expect(current_email.html_part.body.to_s).to include(text)
|
154
|
-
end
|
155
|
-
|
156
|
-
Then /^(?:I|they) should see "([^"]*?)" in the email text part body$/ do |text|
|
157
|
-
expect(current_email.text_part.body.to_s).to include(text)
|
158
|
-
end
|
159
|
-
|
160
|
-
#
|
161
|
-
# Inspect the Email Attachments
|
162
|
-
#
|
163
|
-
|
164
|
-
Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount|
|
165
|
-
expect(current_email_attachments.size).to eql parse_email_count(amount)
|
166
|
-
end
|
167
|
-
|
168
|
-
Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
|
169
|
-
expect(current_email_attachments.select { |a| a.filename == filename }.size).to eql parse_email_count(amount)
|
170
|
-
end
|
171
|
-
|
172
|
-
Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
|
173
|
-
expect(current_email_attachments[(index.to_i - 1)].filename).to eql filename
|
174
|
-
end
|
175
|
-
|
176
|
-
Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
|
177
|
-
expect(current_email_attachments.select { |a| a.content_type.include?(content_type) }.size).to eql parse_email_count(amount)
|
178
|
-
end
|
179
|
-
|
180
|
-
Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
|
181
|
-
expect(current_email_attachments[(index.to_i - 1)].content_type).to include(content_type)
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^all attachments should not be blank$/ do
|
185
|
-
current_email_attachments.each do |attachment|
|
186
|
-
expect(attachment.read.size).to_not eql 0
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
Then /^show me a list of email attachments$/ do
|
191
|
-
EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
|
192
|
-
end
|
193
|
-
|
194
|
-
#
|
195
|
-
# Interact with Email Contents
|
196
|
-
#
|
197
|
-
|
198
|
-
When /^(?:I|they|"([^"]*?)") follows? "([^"]*?)" in the email$/ do |address, link|
|
199
|
-
visit_in_email(link, address)
|
200
|
-
end
|
201
|
-
|
202
|
-
When /^(?:I|they) click the first link in the email$/ do
|
203
|
-
click_first_link_in_email
|
204
|
-
end
|
205
|
-
|
206
|
-
#
|
207
|
-
# Debugging
|
208
|
-
# These only work with Rails and OSx ATM since EmailViewer uses RAILS_ROOT and OSx's 'open' command.
|
209
|
-
# Patches accepted. ;)
|
210
|
-
#
|
211
|
-
|
212
|
-
Then /^save and open current email$/ do
|
213
|
-
EmailSpec::EmailViewer::save_and_open_email(current_email)
|
214
|
-
end
|
215
|
-
|
216
|
-
Then /^save and open all text emails$/ do
|
217
|
-
EmailSpec::EmailViewer::save_and_open_all_text_emails
|
218
|
-
end
|
219
|
-
|
220
|
-
Then /^save and open all html emails$/ do
|
221
|
-
EmailSpec::EmailViewer::save_and_open_all_html_emails
|
222
|
-
end
|
223
|
-
|
224
|
-
Then /^save and open all raw emails$/ do
|
225
|
-
EmailSpec::EmailViewer::save_and_open_all_raw_emails
|
226
|
-
end
|
File without changes
|