email_spec 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +16 -11
- data/lib/email_spec/matchers.rb +45 -42
- data/spec/email_spec/helpers_spec.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
@@ -3,6 +3,11 @@ This is the Rails 2 compatible branch/gem.
|
|
3
3
|
|
4
4
|
== 0.6.x (git)
|
5
5
|
|
6
|
+
== 0.6.4
|
7
|
+
|
8
|
+
=== Bugfixes
|
9
|
+
* Updates the matchers to use RSpec's new API instead of deprecated simple_matcher. (Aaron Gibralter)
|
10
|
+
|
6
11
|
== 0.6.3
|
7
12
|
|
8
13
|
=== Bugfixes
|
@@ -33,7 +38,7 @@ This is the Rails 2 compatible branch/gem.
|
|
33
38
|
=== Changes
|
34
39
|
* Deprecated steps were removed. (Kieran Pilkington)
|
35
40
|
|
36
|
-
===
|
41
|
+
=== Bugfixes
|
37
42
|
|
38
43
|
== 0.5.0 2010-02-22
|
39
44
|
|
@@ -46,10 +51,10 @@ This is the Rails 2 compatible branch/gem.
|
|
46
51
|
* "save and open all html emails"
|
47
52
|
* "save and open all raw emails"
|
48
53
|
|
49
|
-
===
|
54
|
+
=== Bugfixes
|
50
55
|
* Gracefully handle cases where emails do not have a 'to' value. (Kieran Pilkington)
|
51
56
|
|
52
|
-
===
|
57
|
+
=== Bugfixes
|
53
58
|
|
54
59
|
== 0.4.0 2010-01-07
|
55
60
|
|
@@ -57,12 +62,12 @@ This is the Rails 2 compatible branch/gem.
|
|
57
62
|
* Added support for action_mailer_cache_delivery plugin. (Dan Dofter)
|
58
63
|
You must use the fork at: http://github.com/liangzan/action_mailer_cache_delivery
|
59
64
|
|
60
|
-
===
|
65
|
+
=== Bugfixes
|
61
66
|
* be_delivered_from matcher now compares both sender name and email address. (Dan Dofter)
|
62
67
|
|
63
68
|
== 0.3.8 2009-12-23
|
64
69
|
|
65
|
-
===
|
70
|
+
=== Bugfixes
|
66
71
|
* Guard against cc and bcc fields being nil for ActionMailer. (Piotr Sarnacki)
|
67
72
|
|
68
73
|
== 0.3.7 2009-12-17
|
@@ -122,7 +127,7 @@ Big shoutout to Kieran Pilkington who did the majority of work for this release.
|
|
122
127
|
* Then /^I should not receive any emails?$/
|
123
128
|
* When %r{^"([^"]*?)" opens? the email$} do |address|
|
124
129
|
|
125
|
-
===
|
130
|
+
=== Bugfixes
|
126
131
|
|
127
132
|
== 0.2.1 2009-5-29
|
128
133
|
|
@@ -138,19 +143,19 @@ No changes. Bumping version for RubyForge release.
|
|
138
143
|
|
139
144
|
== 0.1.4 2009-5-29
|
140
145
|
|
141
|
-
===
|
146
|
+
=== Bugfixes
|
142
147
|
* Require deliveries in the helpers so it doesn't blow up with RSpec. (Craig Webster)
|
143
148
|
|
144
149
|
== 0.1.3 2009-4-15
|
145
150
|
|
146
|
-
===
|
151
|
+
=== Bugfixes
|
147
152
|
* Fixed regular expressions in genertaed steps. (Ben Mabey)
|
148
153
|
* World semantics changed in cucumber (0.2.3.2), email_spec now uses the new API. (Hector Morales)
|
149
154
|
|
150
155
|
== 0.1.2 2009-4-05
|
151
156
|
|
152
157
|
=== New features
|
153
|
-
===
|
158
|
+
=== Bugfixes
|
154
159
|
* Actually added the renamed generators to the gem so people could use it! D'oh! (Ben Mabey)
|
155
160
|
* You can either use "./script generate email_spec" or "rubigen rails email_spec"
|
156
161
|
* Removed Rake tasks from example application to prevent conflicts when used as a plugin. (Ben Mabey)
|
@@ -159,7 +164,7 @@ No changes. Bumping version for RubyForge release.
|
|
159
164
|
=== New features
|
160
165
|
* Switched dir structure over to support rubigen. (Dr. Nic)
|
161
166
|
|
162
|
-
===
|
167
|
+
=== Bugfixes
|
163
168
|
|
164
169
|
== 0.1.0 2009-3-25
|
165
170
|
=== New features
|
@@ -181,7 +186,7 @@ No changes. Bumping version for RubyForge release.
|
|
181
186
|
end
|
182
187
|
end
|
183
188
|
|
184
|
-
===
|
189
|
+
=== Bugfixes
|
185
190
|
* Revert parse_email_for_link helper method to allow for text links as well as explicit link finding. (Mischa Fierer)
|
186
191
|
* Isolated variances between using email-spec with an ARMailer project. (Luke Melia)
|
187
192
|
|
data/lib/email_spec/matchers.rb
CHANGED
@@ -132,86 +132,89 @@ module EmailSpec
|
|
132
132
|
BccTo.new(expected_email_addresses_or_objects_that_respond_to_email.flatten)
|
133
133
|
end
|
134
134
|
|
135
|
-
|
136
|
-
|
135
|
+
Spec::Matchers.define :have_subject do
|
136
|
+
match do |given|
|
137
137
|
given_subject = given.subject
|
138
|
+
expected_subject = expected.first
|
138
139
|
|
139
|
-
if
|
140
|
-
|
141
|
-
|
142
|
-
|
140
|
+
if expected_subject.is_a?(String)
|
141
|
+
description { "have subject of #{expected_subject.inspect}" }
|
142
|
+
failure_message_for_should { "expected the subject to be #{expected_subject.inspect} but was #{given_subject.inspect}" }
|
143
|
+
failure_message_for_should_not { "expected the subject not to be #{expected_subject.inspect} but was" }
|
143
144
|
|
144
|
-
given_subject ==
|
145
|
+
given_subject == expected_subject
|
145
146
|
else
|
146
|
-
|
147
|
-
|
148
|
-
|
147
|
+
description { "have subject matching #{expected_subject.inspect}" }
|
148
|
+
failure_message_for_should { "expected the subject to match #{expected_subject.inspect}, but did not. Actual subject was: #{given_subject.inspect}" }
|
149
|
+
failure_message_for_should_not { "expected the subject not to match #{expected_subject.inspect} but #{given_subject.inspect} does match it." }
|
149
150
|
|
150
|
-
!!(given_subject =~
|
151
|
+
!!(given_subject =~ expected_subject)
|
151
152
|
end
|
152
153
|
end
|
153
154
|
end
|
154
155
|
|
155
|
-
|
156
|
-
|
156
|
+
Spec::Matchers.define :include_email_with_subject do
|
157
|
+
match do |given_emails|
|
158
|
+
expected_subject = expected.first
|
157
159
|
|
158
|
-
if
|
159
|
-
|
160
|
-
|
161
|
-
|
160
|
+
if expected_subject.is_a?(String)
|
161
|
+
description { "include email with subject of #{expected_subject.inspect}" }
|
162
|
+
failure_message_for_should { "expected at least one email to have the subject #{expected_subject.inspect} but none did. Subjects were #{given_emails.map(&:subject).inspect}" }
|
163
|
+
failure_message_for_should_not { "expected no email with the subject #{expected_subject.inspect} but found at least one. Subjects were #{given_emails.map(&:subject).inspect}" }
|
162
164
|
|
163
|
-
given_emails.map(&:subject).include?(
|
165
|
+
given_emails.map(&:subject).include?(expected_subject)
|
164
166
|
else
|
165
|
-
|
166
|
-
|
167
|
-
|
167
|
+
description { "include email with subject matching #{expected_subject.inspect}" }
|
168
|
+
failure_message_for_should { "expected at least one email to have a subject matching #{expected_subject.inspect}, but none did. Subjects were #{given_emails.map(&:subject).inspect}" }
|
169
|
+
failure_message_for_should_not { "expected no email to have a subject matching #{expected_subject.inspect} but found at least one. Subjects were #{given_emails.map(&:subject).inspect}" }
|
168
170
|
|
169
|
-
!!(given_emails.any?{ |mail| mail.subject =~
|
171
|
+
!!(given_emails.any?{ |mail| mail.subject =~ expected_subject })
|
170
172
|
end
|
171
173
|
end
|
172
174
|
end
|
173
175
|
|
174
|
-
|
175
|
-
|
176
|
+
Spec::Matchers.define :have_body_text do
|
177
|
+
match do |given|
|
178
|
+
expected_text = expected.first
|
176
179
|
|
177
|
-
if
|
180
|
+
if expected_text.is_a?(String)
|
178
181
|
normalized_body = given.body.gsub(/\s+/, " ")
|
179
|
-
normalized_expected =
|
180
|
-
|
181
|
-
|
182
|
-
|
182
|
+
normalized_expected = expected_text.gsub(/\s+/, " ")
|
183
|
+
description { "have body including #{normalized_expected.inspect}" }
|
184
|
+
failure_message_for_should { "expected the body to contain #{normalized_expected.inspect} but was #{normalized_body.inspect}" }
|
185
|
+
failure_message_for_should_not { "expected the body not to contain #{normalized_expected.inspect} but was #{normalized_body.inspect}" }
|
183
186
|
|
184
187
|
normalized_body.include?(normalized_expected)
|
185
188
|
else
|
186
189
|
given_body = given.body
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
+
description { "have body matching #{expected_text.inspect}" }
|
191
|
+
failure_message_for_should { "expected the body to match #{expected_text.inspect}, but did not. Actual body was: #{given_body.inspect}" }
|
192
|
+
failure_message_for_should_not { "expected the body not to match #{expected_text.inspect} but #{given_body.inspect} does match it." }
|
190
193
|
|
191
|
-
!!(given_body =~
|
194
|
+
!!(given_body =~ expected_text)
|
192
195
|
end
|
193
196
|
end
|
194
197
|
end
|
195
198
|
|
196
|
-
|
197
|
-
|
199
|
+
Spec::Matchers.define :have_header do
|
200
|
+
match do |given|
|
198
201
|
given_header = given.header
|
202
|
+
expected_name, expected_value = *expected
|
199
203
|
|
200
204
|
if expected_value.is_a?(String)
|
201
|
-
|
202
|
-
|
203
|
-
|
205
|
+
description { "have header #{expected_name}: #{expected_value}" }
|
206
|
+
failure_message_for_should { "expected the headers to include '#{expected_name}: #{expected_value}' but they were #{given_header.inspect}" }
|
207
|
+
failure_message_for_should_not { "expected the headers not to include '#{expected_name}: #{expected_value}' but they were #{given_header.inspect}" }
|
204
208
|
|
205
209
|
given_header[expected_name].to_s == expected_value
|
206
210
|
else
|
207
|
-
|
208
|
-
|
209
|
-
|
211
|
+
description { "have header #{expected_name} with value matching #{expected_value.inspect}" }
|
212
|
+
failure_message_for_should { "expected the headers to include '#{expected_name}' with a value matching #{expected_value.inspect} but they were #{given_header.inspect}" }
|
213
|
+
failure_message_for_should_not { "expected the headers not to include '#{expected_name}' with a value matching #{expected_value.inspect} but they were #{given_header.inspect}" }
|
210
214
|
|
211
215
|
given_header[expected_name].to_s =~ expected_value
|
212
216
|
end
|
213
217
|
end
|
214
218
|
end
|
215
|
-
|
216
219
|
end
|
217
220
|
end
|
@@ -16,7 +16,7 @@ describe EmailSpec::Helpers do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "causes a spec to fail if the body doesn't contain the text specified to click" do
|
19
|
-
email = stub(:has_body_text? => false)
|
19
|
+
email = stub(:has_body_text? => false, :body => "hello")
|
20
20
|
lambda { parse_email_for_link(email, "non-existent text") }.should raise_error(Spec::Expectations::ExpectationNotMetError)
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 4
|
10
|
+
version: 0.6.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Mabey
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-10-06 00:00:00 -06:00
|
21
21
|
default_executable:
|
22
22
|
dependencies: []
|
23
23
|
|