質問編集履歴

2

テスト結果の追記

2019/01/20 01:28

投稿

iyore888
iyore888

スコア40

title CHANGED
File without changes
body CHANGED
@@ -57,7 +57,34 @@
57
57
  end
58
58
  end
59
59
  ```
60
+ #実施したテスト
61
+ ```ruby
62
+ require 'test_helper'
60
63
 
64
+ class UserMailerTest < ActionMailer::TestCase
65
+ test "account_activation" do
66
+ user = users(:michael)
67
+ user.activation_token = User.new_token
68
+ mail = UserMailer.account_activation(user)
69
+ assert_equal "Account activation", mail.subject
70
+ assert_equal ["user.email"], mail.to
71
+ assert_equal ["noreply@example.com"], mail.from
72
+ assert_match user.name, mail.body.encoded
73
+ assert_match user.activation_token, mail.body.encoded
74
+ assert_match CGI.escape(user.email), mail.body.encoded
75
+ end
76
+ ```
77
+
78
+ #テストの結果
79
+ ERROR["test_account_activation", UserMailerTest, 1.1617731160004041]
80
+ test_account_activation#UserMailerTest (1.16s)
81
+ ActionView::MissingTemplate: ActionView::MissingTemplate: Missing template user_mailer/account_activation with "mailer". Searched in:
82
+ * "user_mailer"
83
+
84
+ app/mailers/user_mailer.rb:5:in `account_activation'
85
+ test/mailers/user_mailer_test.rb:8:in `block in <class:UserMailerTest>'
86
+
87
+
61
88
  #エラー後の対処
62
89
  ①タイピングミスを疑い、チュートリアルのコードを貼り付けしました。
63
90
  ②エラーをググって見たのですが、同様の解決策はHITしませんでした。

1

誤字修正

2019/01/20 01:28

投稿

iyore888
iyore888

スコア40

title CHANGED
File without changes
body CHANGED
@@ -23,7 +23,7 @@
23
23
  end
24
24
  ```
25
25
 
26
- #他の関係するソースコード① (config/environments/development.rb)
26
+ #他の関係するソースコード① (config/environments/development.rb)
27
27
  ```ruby
28
28
  .
29
29
  .