email_spec 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 59b44de865e9170316ee1aa9bba93c031d3a9f08
4
- data.tar.gz: 0d42f9542127ea3328897ff6c94b0fb084d0e6ea
2
+ SHA256:
3
+ metadata.gz: 11bdd9e521aecbb968f672214cc109869f111f1ac981b793e1a3c41bcf4691ce
4
+ data.tar.gz: 7cd61105485eae764f8786ef4a3e2ccdbd9309f8d020f883177d8d62df7df184
5
5
  SHA512:
6
- metadata.gz: cebc730b30833546d6bc2f45ab09f08304e89840d673ae4565f23441baa432d5805018d0bb21587a9160b3be295d253de080fc681dac4c1a0f6b3e4095c20216
7
- data.tar.gz: 06da48ccb0f93c0ad05f31626604e07c9446b3c9d88220a5f635a4929a662f593f3edd9a8dafe87a74b62161f2642ac574d3be92a2daab6148afc197849c5bda
6
+ metadata.gz: 540ed6ea489564623c0ab0c781c70842782b8485307cf70d7396fc0221896ac396cae83a58d72e64586bb879b58a68b3e93b61f24120586657fe9acaea9f9486
7
+ data.tar.gz: 57b37098385ff0d8f545e385195693ddf67c04d03d4c37a9219cf4677d36cc2a880e0dea6bca6eed595ac977eb9afd1841062d180e47410ce5ec6fe20c1820fd
data/Changelog.md CHANGED
@@ -1,12 +1,23 @@
1
+ ## 2.2.1 2022-09-12
2
+
3
+ * [Patch for eager loading](https://github.com/email-spec/email-spec/pull/219)
4
+
5
+ ## 2.2.0 2018-04-03
6
+
7
+ * Support for `spinach` (@pedantic-git)
8
+
9
+ ## 2.1.2 2018-04-03
10
+
11
+ * Fix compatibility issue with `mail` gem (@sikachu)
12
+ * Fix cucumber example (@adamdawkins)
13
+
1
14
  ## 2.1.1 2017-05-16
2
15
 
3
- * Add Ruby 2.4 support to Travis: [https://github.com/email-spec/email-spec/pull/197](https://github.com/email-spec/email-spec/pull/197) (@eitoball)
4
- * Suppress warnings for URI.extract: [https://github.com/email-spec/email-spec/pull/195](https://github.com/email-spec/email-spec/pull/195) (@koic)
5
- * Improve Regex to allow space between tags and text: [https://github.com/email-spec/email-spec/pull/194](https://github.com/email-spec/email-spec/pull/194) (@tiagotex)
6
- * Fix dead link in documentation: [https://github.com/email-spec/email-spec/pull/193](https://github.com/email-spec/email-spec/pull/193) (@kingdonb)
7
- * Relax the version for the `mail` dependency: [https://github.com/email-spec/email-spec/pull/199](https://github.com/email-spec/email-spec/pull/199) (@thorncp)
8
- * Add bin/setup to make it easier to get project setup (@etagwerker)
9
- * Changed documentation in gemspec file (@etagwerker)
16
+ * Suppress warnings for URI.extract (@koic)
17
+ * Dead link removal (@kingdonb)
18
+ * Better regexp for link searches (@tiagotex)
19
+ * Relax version requirement for `mail` gem (@thorncp)
20
+ * Add ruby 2.4 to the build matrix (@eitoball)
10
21
 
11
22
  ## 2.1.0 2016-05-04
12
23
 
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
 
@@ -49,12 +48,28 @@ Scenario: A new person signs up
49
48
  Given I am at "/"
50
49
  When I fill in "Email" with "quentin@example.com"
51
50
  And I press "Sign up"
52
- And "quentin@example.com" should receive an email # Specify who should receive the email
51
+ Then "quentin@example.com" should receive an email # Specify who should receive the email
52
+ ```
53
+
54
+ ### Spinach
55
+
56
+ To use the helpers and matchers in your Spinach steps, add this to your env.rb:
57
+
58
+ ```ruby
59
+ require 'email_spec/spinach'
60
+ ```
61
+
62
+ Creating shared steps (as for Cucumber above) doesn't fit so well with the Spinach ethos of very compartmentalized steps, so there is no generator for Spinach. It's easy to use the helpers/matchers in your steps. For example:
63
+
64
+ ```ruby
65
+ step 'the last email sent should welcome the user' do
66
+ expect(last_email_sent).to have_subject('Welcome')
67
+ end
53
68
  ```
54
69
 
55
70
  ### RSpec (3.1+)
56
71
 
57
- First you need to require email_spec in your spec_helper.rb:
72
+ First you need to require `email_spec` in your `spec_helper.rb`:
58
73
 
59
74
  ```ruby
60
75
  require "email_spec"
@@ -63,6 +78,12 @@ require "email_spec/rspec"
63
78
 
64
79
  This will load all the helpers that the scenarios can count on. It will also add a `before(:each)` hook so that emails are cleared at the start of each scenario.
65
80
 
81
+ If you are upgrading to Rails 5, make sure your `rails_helper.rb` requires `spec_helper` **after** loading the environment. For example:
82
+ ```ruby
83
+ require File.expand_path('../../config/environment', __FILE__)
84
+ require 'spec_helper'
85
+ ```
86
+
66
87
  ### MiniTest
67
88
 
68
89
  First you need to require minitest-matchers and email_spec in your test_helper.rb:
@@ -317,6 +338,10 @@ email = UserMailer.create_signup "jojo@yahoo.com", "Jojo Binks"
317
338
  assert_must deliver_to("jojo@yahoo.com"), email
318
339
  ```
319
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
+
320
345
  ## Original Authors
321
346
 
322
347
  Ben Mabey, Aaron Gibralter, Mischa Fierer
@@ -22,8 +22,8 @@ ActiveRecord::Schema.define(version: 20141119224309) do
22
22
  t.datetime "locked_at"
23
23
  t.datetime "failed_at"
24
24
  t.string "locked_by"
25
- t.datetime "created_at", null: false
26
- t.datetime "updated_at", null: false
25
+ t.datetime "created_at"
26
+ t.datetime "updated_at"
27
27
  t.string "queue"
28
28
  end
29
29
 
@@ -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
- def mailer; ActionMailer::Base; end
80
- include EmailSpec::MailerDeliveries
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
-
@@ -4,11 +4,12 @@ module EmailSpec::MailExt
4
4
  end
5
5
 
6
6
  def default_part_body
7
- HTMLEntities.new.decode(default_part.body)
7
+ # Calling to_str as we want the actual String object
8
+ HTMLEntities.new.decode(default_part.decoded.to_s.to_str)
8
9
  end
9
10
 
10
11
  def html
11
- html_part ? html_part.body.raw_source : nil
12
+ html_part ? html_part.decoded : nil
12
13
  end
13
14
  end
14
15
 
@@ -0,0 +1,28 @@
1
+ # Require this in your spinach features/support/env.rb file to get access
2
+ # to the helpers and matchers in your steps.
3
+
4
+ if defined?(ActionMailer)
5
+ unless [:test, :activerecord, :cache, :file].include?(ActionMailer::Base.delivery_method)
6
+ ActionMailer::Base.register_observer(EmailSpec::TestObserver)
7
+ end
8
+ ActionMailer::Base.perform_deliveries = true
9
+
10
+ Spinach.hooks.before_scenario do
11
+ # Scenario setup
12
+ case ActionMailer::Base.delivery_method
13
+ when :test then ActionMailer::Base.deliveries.clear
14
+ when :cache then ActionMailer::Base.clear_cache
15
+ end
16
+ end
17
+ end
18
+
19
+ Spinach.hooks.after_scenario do
20
+ EmailSpec::EmailViewer.save_and_open_all_raw_emails if ENV['SHOW_EMAILS']
21
+ EmailSpec::EmailViewer.save_and_open_all_html_emails if ENV['SHOW_HTML_EMAILS']
22
+ EmailSpec::EmailViewer.save_and_open_all_text_emails if ENV['SHOW_TEXT_EMAILS']
23
+ end
24
+
25
+ class Spinach::FeatureSteps
26
+ include EmailSpec::Helpers
27
+ include EmailSpec::Matchers
28
+ end
@@ -1,3 +1,3 @@
1
1
  module EmailSpec
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.2.1'
3
3
  end
@@ -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
@@ -30,6 +31,18 @@ describe EmailSpec::MailExt do
30
31
  email = Mail.new(:body => "hi")
31
32
  expect(email.default_part.body).to eq(email.default_part_body)
32
33
  end
34
+
35
+ it "compatible with ActiveSupport::SafeBuffer" do
36
+ email = Mail.new(:body => ActiveSupport::SafeBuffer.new("bacon & pancake"))
37
+ expect(email.default_part_body).to eq ("bacon & pancake")
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
33
46
  end
34
47
 
35
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.1.1
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: 2017-05-16 00:00:00.000000000 Z
13
+ date: 2022-09-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: htmlentities
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.6'
49
+ version: '2.7'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '2.6'
56
+ version: '2.7'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rake
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -287,6 +280,7 @@ files:
287
280
  - lib/email_spec/mail_ext.rb
288
281
  - lib/email_spec/matchers.rb
289
282
  - lib/email_spec/rspec.rb
283
+ - lib/email_spec/spinach.rb
290
284
  - lib/email_spec/test_observer.rb
291
285
  - lib/email_spec/version.rb
292
286
  - lib/generators/email_spec/steps/steps_generator.rb
@@ -300,7 +294,7 @@ homepage: http://github.com/email-spec/email-spec/
300
294
  licenses:
301
295
  - MIT
302
296
  metadata: {}
303
- post_install_message:
297
+ post_install_message:
304
298
  rdoc_options: []
305
299
  require_paths:
306
300
  - lib
@@ -315,9 +309,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
309
  - !ruby/object:Gem::Version
316
310
  version: '0'
317
311
  requirements: []
318
- rubyforge_project: email-spec
319
- rubygems_version: 2.6.8
320
- signing_key:
312
+ rubygems_version: 3.3.21
313
+ signing_key:
321
314
  specification_version: 4
322
315
  summary: Easily test email in RSpec, Cucumber or Minitest
323
316
  test_files: []
@@ -1,189 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- email_spec (2.1.0)
5
- htmlentities (~> 4.3.3)
6
- launchy (~> 2.1)
7
- mail (~> 2.6)
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.1)
47
- public_suffix (~> 2.0, >= 2.0.2)
48
- arel (6.0.4)
49
- builder (3.2.3)
50
- capybara (2.14.0)
51
- addressable
52
- mime-types (>= 1.16)
53
- nokogiri (>= 1.3.3)
54
- rack (>= 1.0.0)
55
- rack-test (>= 0.5.4)
56
- xpath (~> 2.0)
57
- concurrent-ruby (1.0.5)
58
- cucumber (2.4.0)
59
- builder (>= 2.1.2)
60
- cucumber-core (~> 1.5.0)
61
- cucumber-wire (~> 0.0.1)
62
- diff-lcs (>= 1.1.3)
63
- gherkin (~> 4.0)
64
- multi_json (>= 1.7.5, < 2.0)
65
- multi_test (>= 0.1.2)
66
- cucumber-core (1.5.0)
67
- gherkin (~> 4.0)
68
- cucumber-rails (1.5.0)
69
- capybara (>= 1.1.2, < 3)
70
- cucumber (>= 1.3.8, < 4)
71
- mime-types (>= 1.17, < 4)
72
- nokogiri (~> 1.5)
73
- railties (>= 4, < 5.2)
74
- cucumber-wire (0.0.1)
75
- database_cleaner (1.6.1)
76
- delayed_job (4.0.6)
77
- activesupport (>= 3.0, < 5.0)
78
- delayed_job_active_record (4.1.1)
79
- activerecord (>= 3.0, < 5.1)
80
- delayed_job (>= 3.0, < 5)
81
- diff-lcs (1.3)
82
- erubis (2.7.0)
83
- gherkin (4.1.3)
84
- globalid (0.4.0)
85
- activesupport (>= 4.2.0)
86
- htmlentities (4.3.4)
87
- i18n (0.8.1)
88
- launchy (2.4.3)
89
- addressable (~> 2.3)
90
- loofah (2.0.3)
91
- nokogiri (>= 1.5.9)
92
- mail (2.6.5)
93
- mime-types (>= 1.16, < 4)
94
- mime-types (3.1)
95
- mime-types-data (~> 3.2015)
96
- mime-types-data (3.2016.0521)
97
- mimetype-fu (0.1.2)
98
- mini_portile2 (2.1.0)
99
- minitest (5.10.2)
100
- minitest-matchers (1.4.1)
101
- minitest (~> 5.0)
102
- minitest-rails (2.2.1)
103
- minitest (~> 5.7)
104
- railties (~> 4.1)
105
- multi_json (1.12.1)
106
- multi_test (0.1.2)
107
- nokogiri (1.7.2)
108
- mini_portile2 (~> 2.1.0)
109
- public_suffix (2.0.5)
110
- rack (1.6.7)
111
- rack-test (0.6.3)
112
- rack (>= 1.0)
113
- rails (4.2.8)
114
- actionmailer (= 4.2.8)
115
- actionpack (= 4.2.8)
116
- actionview (= 4.2.8)
117
- activejob (= 4.2.8)
118
- activemodel (= 4.2.8)
119
- activerecord (= 4.2.8)
120
- activesupport (= 4.2.8)
121
- bundler (>= 1.3.0, < 2.0)
122
- railties (= 4.2.8)
123
- sprockets-rails
124
- rails-deprecated_sanitizer (1.0.3)
125
- activesupport (>= 4.2.0.alpha)
126
- rails-dom-testing (1.0.8)
127
- activesupport (>= 4.2.0.beta, < 5.0)
128
- nokogiri (~> 1.6)
129
- rails-deprecated_sanitizer (>= 1.0.1)
130
- rails-html-sanitizer (1.0.3)
131
- loofah (~> 2.0)
132
- railties (4.2.8)
133
- actionpack (= 4.2.8)
134
- activesupport (= 4.2.8)
135
- rake (>= 0.8.7)
136
- thor (>= 0.18.1, < 2.0)
137
- rake (10.3.2)
138
- rspec-core (3.6.0)
139
- rspec-support (~> 3.6.0)
140
- rspec-expectations (3.6.0)
141
- diff-lcs (>= 1.2.0, < 2.0)
142
- rspec-support (~> 3.6.0)
143
- rspec-mocks (3.6.0)
144
- diff-lcs (>= 1.2.0, < 2.0)
145
- rspec-support (~> 3.6.0)
146
- rspec-rails (3.6.0)
147
- actionpack (>= 3.0)
148
- activesupport (>= 3.0)
149
- railties (>= 3.0)
150
- rspec-core (~> 3.6.0)
151
- rspec-expectations (~> 3.6.0)
152
- rspec-mocks (~> 3.6.0)
153
- rspec-support (~> 3.6.0)
154
- rspec-support (3.6.0)
155
- sprockets (3.7.1)
156
- concurrent-ruby (~> 1.0)
157
- rack (> 1, < 3)
158
- sprockets-rails (3.2.0)
159
- actionpack (>= 4.0)
160
- activesupport (>= 4.0)
161
- sprockets (>= 3.0.0)
162
- sqlite3 (1.3.13)
163
- thor (0.19.4)
164
- thread_safe (0.3.6)
165
- tzinfo (1.2.3)
166
- thread_safe (~> 0.1)
167
- xpath (2.0.0)
168
- nokogiri (~> 1.3)
169
-
170
- PLATFORMS
171
- ruby
172
-
173
- DEPENDENCIES
174
- capybara
175
- cucumber-rails
176
- database_cleaner
177
- delayed_job (~> 4.0.6)
178
- delayed_job_active_record
179
- email_spec!
180
- mimetype-fu
181
- minitest-matchers
182
- minitest-rails
183
- rails (= 4.2.8)
184
- rake (~> 10.3.2)
185
- rspec-rails
186
- sqlite3
187
-
188
- BUNDLED WITH
189
- 1.14.6
Binary file