2016-10-27 9 views
0

私はMichal hartlのチュートリアルに従うことで、レール上でルビーを学ぼうとしています。 しかし、まだ学生はそれを早く拾おうとしています。 しかし、私は第11章で「メーラーテスト」という特定の部分について悩んでいます。ここマイケルhartl第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 ["[email protected]"], 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 

希望の誰かが助け、それが失敗した理由を私に説明することができますされています

それは私に次の障害を与えましたか?

ありがとうございました

答えて

0

私はすでに解決済みです。 マップ構造の間違いがありました。 かなりノービッシュミスhahaha。

関連する問題