質問編集履歴

2

テスト結果の追記

2019/01/20 01:28

投稿

iyore888
iyore888

スコア40

test CHANGED
File without changes
test CHANGED
@@ -116,6 +116,60 @@
116
116
 
117
117
  ```
118
118
 
119
+ #実施したテスト
120
+
121
+ ```ruby
122
+
123
+ require 'test_helper'
124
+
125
+
126
+
127
+ class UserMailerTest < ActionMailer::TestCase
128
+
129
+ test "account_activation" do
130
+
131
+ user = users(:michael)
132
+
133
+ user.activation_token = User.new_token
134
+
135
+ mail = UserMailer.account_activation(user)
136
+
137
+ assert_equal "Account activation", mail.subject
138
+
139
+ assert_equal ["user.email"], mail.to
140
+
141
+ assert_equal ["noreply@example.com"], mail.from
142
+
143
+ assert_match user.name, mail.body.encoded
144
+
145
+ assert_match user.activation_token, mail.body.encoded
146
+
147
+ assert_match CGI.escape(user.email), mail.body.encoded
148
+
149
+ end
150
+
151
+ ```
152
+
153
+
154
+
155
+ #テストの結果
156
+
157
+ ERROR["test_account_activation", UserMailerTest, 1.1617731160004041]
158
+
159
+ test_account_activation#UserMailerTest (1.16s)
160
+
161
+ ActionView::MissingTemplate: ActionView::MissingTemplate: Missing template user_mailer/account_activation with "mailer". Searched in:
162
+
163
+ * "user_mailer"
164
+
165
+
166
+
167
+ app/mailers/user_mailer.rb:5:in `account_activation'
168
+
169
+ test/mailers/user_mailer_test.rb:8:in `block in <class:UserMailerTest>'
170
+
171
+
172
+
119
173
 
120
174
 
121
175
  #エラー後の対処

1

誤字修正

2019/01/20 01:28

投稿

iyore888
iyore888

スコア40

test CHANGED
File without changes
test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
 
50
50
 
51
- #他の関係するソースコード① (config/environments/development.rb)
51
+ #他の関係するソースコード① (config/environments/development.rb)
52
52
 
53
53
  ```ruby
54
54