capybara-email 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -5
- data/lib/capybara/email/driver.rb +3 -0
- data/lib/capybara/email/version.rb +1 -1
- data/lib/capybara/node/email.rb +14 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ef4fdf419a53ce0ec2e89f2959160b3e0c8ee1a
|
4
|
+
data.tar.gz: 5ebab8b7675a663ba2823fdb84f0443242eee18e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 447ca55e3abd05dd6c0828701715233ec9ca8bf0e7412009c03d34318b0284f7a06fbe4aab609e0c28ce74c6ff4b2f6a22845c32f4354bfb2b0e5a889ee783e7
|
7
|
+
data.tar.gz: 7c150883ba441154a4772960147f4713524c47dc7c2ddfad5bf0c1393c401780c6d3d769dca4a94ceea585044cb3600359dc12c91a9d4127c5fd82667cdde8c2
|
data/README.md
CHANGED
@@ -54,6 +54,10 @@ feature 'Emailer' do
|
|
54
54
|
expect(current_email).to have_content 'Hello Joe!'
|
55
55
|
end
|
56
56
|
|
57
|
+
scenario 'testing for attachments' do
|
58
|
+
expect(current_email.attachments.first.filename).to eq 'filename.csv'
|
59
|
+
end
|
60
|
+
|
57
61
|
scenario 'testing for a custom header' do
|
58
62
|
expect(current_email.headers).to include 'header-key'
|
59
63
|
end
|
@@ -160,12 +164,34 @@ The `current_email` method will delegate all necessary method calls to
|
|
160
164
|
`Mail::Message`. So if you need to access the subject of an email:
|
161
165
|
|
162
166
|
```ruby
|
163
|
-
current_email.subject
|
167
|
+
current_email.subject
|
164
168
|
```
|
165
169
|
|
166
170
|
Check out API for the `mail` gem for details on what methods are
|
167
171
|
available.
|
168
172
|
|
173
|
+
## Setting your test host
|
174
|
+
When testing, it's common to want to open an email and click through to your
|
175
|
+
application. To do this, you'll probably need to update your test
|
176
|
+
environment, as well as Capybara's configuration.
|
177
|
+
|
178
|
+
By default, Capybara's `app_host` is set to
|
179
|
+
`http://example.com.` You should update this so that it points to the
|
180
|
+
same host as your test environment. In our example, we'll update both to
|
181
|
+
`http://localhost:3001`:
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
# tests/test_helper.rb
|
185
|
+
ActionDispatch::IntegrationTest
|
186
|
+
Capybara.server_port = 3001
|
187
|
+
Capybara.app_host = 'http://localhost:3001'
|
188
|
+
end
|
189
|
+
|
190
|
+
# config/environments/test.rb
|
191
|
+
config.action_mailer.default_url_options = { host: 'localhost',
|
192
|
+
port: 3001 }
|
193
|
+
```
|
194
|
+
|
169
195
|
## Sending Emails with JavaScript ##
|
170
196
|
Sending emails asynchronously will cause `#open_email` to not open the
|
171
197
|
correct email or not find any email at all depending on the state of the
|
@@ -195,14 +221,11 @@ pull requests to specific branches rather than master.
|
|
195
221
|
|
196
222
|
Please make sure you include tests!
|
197
223
|
|
198
|
-
Unless Rails drops support for Ruby 1.8.7 we will continue to use the
|
199
|
-
hash-rocket syntax. Please respect this.
|
200
|
-
|
201
224
|
Don't use tabs to indent, two spaces are the standard.
|
202
225
|
|
203
226
|
## Legal ##
|
204
227
|
|
205
|
-
[DockYard](http://dockyard.com),
|
228
|
+
[DockYard](http://dockyard.com), Inc. © 2014
|
206
229
|
|
207
230
|
[@dockyard](http://twitter.com/dockyard)
|
208
231
|
|
data/lib/capybara/node/email.rb
CHANGED
@@ -7,6 +7,12 @@ class Capybara::Node::Email < Capybara::Node::Document
|
|
7
7
|
base.raw
|
8
8
|
end
|
9
9
|
|
10
|
+
# Treat the message's body as a Capybara::Node::Simple so that
|
11
|
+
# selectors actually work instead of raising NotImplementedErrors
|
12
|
+
def body_as_simple_node
|
13
|
+
@body_as_simple_node ||= Capybara.string base.raw
|
14
|
+
end
|
15
|
+
|
10
16
|
# Returns the value of the passed in header key.
|
11
17
|
#
|
12
18
|
# @return String
|
@@ -55,7 +61,14 @@ class Capybara::Node::Email < Capybara::Node::Document
|
|
55
61
|
|
56
62
|
private
|
57
63
|
|
64
|
+
# Tries to send to `base` first.
|
65
|
+
# If an NotImplementedError is hit because some finders/matchers/etc. aren't implemented,
|
66
|
+
# fall back to treating the message body as a Capybara::Node::Simple
|
58
67
|
def method_missing(meth, *args, &block)
|
59
|
-
|
68
|
+
begin
|
69
|
+
base.send(meth, *args)
|
70
|
+
rescue NotImplementedError
|
71
|
+
body_as_simple_node.send(meth, *args)
|
72
|
+
end
|
60
73
|
end
|
61
74
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Cardarella
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capybara
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: actionmailer
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bourne
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Test your ActionMailer and Mailer messages in Capybara
|
@@ -120,17 +120,17 @@ require_paths:
|
|
120
120
|
- lib
|
121
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.4.5.1
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Test your ActionMailer and Mailer messages in Capybara
|