email_spec 2.1.2 → 2.2.0

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
2
  SHA1:
3
- metadata.gz: c4383533b6252c77811673fd53ccedebb08915e3
4
- data.tar.gz: d56baa0bb4d65bb10ec64d1bc9da87ab07fa1dd2
3
+ metadata.gz: 6953e2bb1e960ed248a93cd7cbf47dbc0dedbfa3
4
+ data.tar.gz: 48595daa6d8a485acae168fd690261db13e39216
5
5
  SHA512:
6
- metadata.gz: b5aa679fe3f0b632e0ee75d5bb1008283b9382f739a39ac4b159086b93ef855e0bea360d62d77f47fd0b76fc7480f7db7f8f3ad9226491aa41c01a9f26c9d9e7
7
- data.tar.gz: c997df47ffa7a33f20fa2ef807f3d41ca588a6e3c1e0f055593c36513bb1d8e43beea0bf0c1b46500e535e726d3fe0e72a0e4c315d121cd0a62e5febcdfed5fe
6
+ metadata.gz: edf125d376b91ba678cb815c18413618d8062bd89b39a039629ce304c1f5ec057cd07f9ad37e38f6ef4f2debbba226310075f0b72ff72e795d9e757dc5a052f8
7
+ data.tar.gz: 82794056b0200b35691a1e359a5c5b23c58abb09fa25c3798b1f3b18ee3145256115ffc615cedd5aedabedd66ab80bb81adbdf3c840901a92c4b0a2d8ad9ef81
@@ -1,3 +1,7 @@
1
+ ## 2.2.0 2018-04-03
2
+
3
+ * Support for `spinach` (@pedantic-git)
4
+
1
5
  ## 2.1.2 2018-04-03
2
6
 
3
7
  * Fix compatibility issue with `mail` gem (@sikachu)
data/README.md CHANGED
@@ -52,6 +52,22 @@ Scenario: A new person signs up
52
52
  Then "quentin@example.com" should receive an email # Specify who should receive the email
53
53
  ```
54
54
 
55
+ ### Spinach
56
+
57
+ To use the helpers and matchers in your Spinach steps, add this to your env.rb:
58
+
59
+ ```ruby
60
+ require 'email_spec/spinach'
61
+ ```
62
+
63
+ 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:
64
+
65
+ ```ruby
66
+ step 'the last email sent should welcome the user' do
67
+ expect(last_email_sent).to have_subject('Welcome')
68
+ end
69
+ ```
70
+
55
71
  ### RSpec (3.1+)
56
72
 
57
73
  First you need to require `email_spec` in your `spec_helper.rb`:
@@ -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
 
@@ -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.2'
2
+ VERSION = '2.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Mabey
@@ -287,6 +287,7 @@ files:
287
287
  - lib/email_spec/mail_ext.rb
288
288
  - lib/email_spec/matchers.rb
289
289
  - lib/email_spec/rspec.rb
290
+ - lib/email_spec/spinach.rb
290
291
  - lib/email_spec/test_observer.rb
291
292
  - lib/email_spec/version.rb
292
293
  - lib/generators/email_spec/steps/steps_generator.rb