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 +4 -4
- data/Changelog.md +4 -0
- data/README.md +16 -0
- data/examples/rails4_root/db/schema.rb +2 -2
- data/lib/email_spec/spinach.rb +28 -0
- data/lib/email_spec/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6953e2bb1e960ed248a93cd7cbf47dbc0dedbfa3
|
4
|
+
data.tar.gz: 48595daa6d8a485acae168fd690261db13e39216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf125d376b91ba678cb815c18413618d8062bd89b39a039629ce304c1f5ec057cd07f9ad37e38f6ef4f2debbba226310075f0b72ff72e795d9e757dc5a052f8
|
7
|
+
data.tar.gz: 82794056b0200b35691a1e359a5c5b23c58abb09fa25c3798b1f3b18ee3145256115ffc615cedd5aedabedd66ab80bb81adbdf3c840901a92c4b0a2d8ad9ef81
|
data/Changelog.md
CHANGED
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"
|
26
|
-
t.datetime "updated_at"
|
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
|
data/lib/email_spec/version.rb
CHANGED
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.
|
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
|