2
I以下のRSpecのテストがあります。RSpecのメーラーのテストマッチ
1) UserMailer Password reset instructions
Failure/Error: email.body.encoded.should match(edit_user_password_url(:reset_password_token => user.reset_password_token))
expected "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>\r\n</head>\r\n<body>\r\n<h1>Hey Tester</h1>\r\n<p>Forget your password? Its cool-- it happens to the best of us.</p>\r\n<p>To reset the password to your TippingPress account, click the link below:</p>\r\n<p><a href=\"http://localhost:3000/users/password/edit?reset_password_token=8RMhiAxsRihME1mL7JiE\">Change my password</a></p>\r\n<p>If you didn’t request a password change, you can email us at [email protected]</p>\r\n<p>Best,</p>\r\n<p>\r\nAlex & Larson\r\n<br>\r\n<a href=\"http://www.tippingpress.com\">TippingPress.com</a>\r\n</p>\r\n</body>\r\n</html>\r\n" to match "http://localhost:3000/users/password/edit?reset_password_token=8RMhiAxsRihME1mL7JiE"
:
it "Password reset instructions" do
user = Factory(:user)
user.send_reset_password_instructions
email = last_email
email.body.encoded.should match(edit_user_password_url(:reset_password_token => user.reset_password_token))
end
が
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%body
%h1 Hey #{@resource.first_name}
%p Forget your password? Its cool-- it happens to the best of us.
%p To reset the password to your TippingPress account, click the link below:
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
%p If you didn’t request a password change, you can email us at [email protected]
%p Best,
%p
Alex & Larson
%br
= link_to "TippingPress.com", "http://www.tippingpress.com"
は、私は次のエラーを取得するメーラーでedit_password_urlと一致するようにしよう2つのURLの一致のように見えますが、私はこれがREGEXや文字の知識の欠如のため何らかのエラーであると推測していますエンコーディング。前もって感謝します!