我正在学习rails上的ruby,学习Michal的教程。但仍然是一个学习的学生,试图迅速捡起它。但是我在第11章中被困在一个特定的部分,那就是“邮件测试”。
它给了我以下的失败:
FAIL["test_account_activation", UserMailerTest, 0.8010926319984719]
test_account_activation#UserMailerTest (0.80s)
Expected /Michael\ Example/ to match # encoding: US-ASCII
"\r\n----==_mimepart_5811b80d754fe_7347fb30ec66649\r\nContent-Type: text/plain;\r\n charset=UTF-8\r\nContent-Transfer-Encoding: 7bit\r\n\r\nUser#account_activation\r\n\r\n, find me in app/views/user_mailer/account_activation.text.erb\r\n\r\n\r\n----==_mimepart_5811b80d754fe_7347fb30ec66649\r\nContent-Type: text/html;\r\n charset=UTF-8\r\nContent-Transfer-Encoding: 7bit\r\n\r\n<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n <style>\r\n /* Email styles need to be inline */\r\n </style>\r\n </head>\r\n\r\n <body>\r\n <h1>User#account_activation</h1>\r\n\r\n<p>\r\n , find me in app/views/user_mailer/account_activation.html.erb\r\n</p>\r\n\r\n </body>\r\n</html>\r\n\r\n----==_mimepart_5811b80d754fe_7347fb30ec66649--\r\n".
test/mailers/user_mailer_test.rb:12:in `block in <class:UserMailerTest>'这是我的user_mailer_test.rb
require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
test "account_activation" do
user = users(:michael)
user.activation_token = User.new_token
mail = UserMailer.account_activation(user)
assert_equal "Account activation", mail.subject
assert_equal [user.email], mail.to
assert_equal ["noreply@example.com"], mail.from
assert_match user.name, mail.body.encoded
assert_match user.activation_token, mail.body.encoded
assert_match CGI.escape(user.email), mail.body.encoded
end
end希望有人能帮我解释一下失败的原因?
非常感谢
发布于 2016-10-27 09:59:14
我已经修好了。地图结构出现了一些错误。相当愚蠢的错误哈哈哈。
https://stackoverflow.com/questions/40279730
复制相似问题