2016-10-27 4 views
0

Ich versuche Ruby auf Schienen zu lernen, indem ich dem Tutorial von Michal hartl folge. Aber noch ein Lernschüler, der versucht, es schnell aufzuheben. Aber ich stehe in Kapitel 11 auf einen bestimmten Teil, der "Mailer-Test" ist.Michael hartl Kapitel 11 Mailer Testfehler

es gab mir die folgenden Fehler an:

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>' 

hier ist mein 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 

Hoffnung jemand kann mir helfen und erklären, warum es gescheitert?

danke viel

Antwort

0

Ich habe es schon behoben. Es gab einige Kartenstrukturfehler. Ziemlich noobish Fehler hahaha.

Verwandte Themen