@@ -164,20 +164,24 class ActiveSupport::TestCase | |||
|
164 | 164 | |
|
165 | 165 | def assert_mail_body_match(expected, mail) |
|
166 | 166 | if expected.is_a?(String) |
|
167 |
assert_include expected, mail |
|
|
167 | assert_include expected, mail_body(mail) | |
|
168 | 168 | else |
|
169 |
assert_match expected, mail |
|
|
169 | assert_match expected, mail_body(mail) | |
|
170 | 170 | end |
|
171 | 171 | end |
|
172 | 172 | |
|
173 | 173 | def assert_mail_body_no_match(expected, mail) |
|
174 | 174 | if expected.is_a?(String) |
|
175 |
assert_not_include expected, mail |
|
|
175 | assert_not_include expected, mail_body(mail) | |
|
176 | 176 | else |
|
177 |
assert_no_match expected, mail |
|
|
177 | assert_no_match expected, mail_body(mail) | |
|
178 | 178 | end |
|
179 | 179 | end |
|
180 | 180 | |
|
181 | def mail_body(mail) | |
|
182 | mail.body | |
|
183 | end | |
|
184 | ||
|
181 | 185 | # Shoulda macros |
|
182 | 186 | def self.should_render_404 |
|
183 | 187 | should_respond_with :not_found |
@@ -158,7 +158,7 class Redmine::Hook::ManagerTest < ActiveSupport::TestCase | |||
|
158 | 158 | Mailer.deliver_issue_add(issue) |
|
159 | 159 | mail2 = ActionMailer::Base.deliveries.last |
|
160 | 160 | |
|
161 |
assert_equal mail |
|
|
161 | assert_equal mail_body(mail), mail_body(mail2) | |
|
162 | 162 | end |
|
163 | 163 | |
|
164 | 164 | def hook_helper |
@@ -272,8 +272,8 class MailHandlerTest < ActiveSupport::TestCase | |||
|
272 | 272 | email = ActionMailer::Base.deliveries.first |
|
273 | 273 | assert_not_nil email |
|
274 | 274 | assert email.subject.include?('account activation') |
|
275 |
login = email |
|
|
276 |
password = email |
|
|
275 | login = mail_body(email).match(/\* Login: (.*)$/)[1] | |
|
276 | password = mail_body(email).match(/\* Password: (.*)$/)[1] | |
|
277 | 277 | assert_equal issue.author, User.try_to_login(login, password) |
|
278 | 278 | end |
|
279 | 279 | end |
General Comments 0
You need to be logged in to leave comments.
Login now