質問編集履歴

1

エラー内容を追加

2019/05/17 12:59

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,18 +18,12 @@
18
18
 
19
19
 
20
20
 
21
- #get /password_resets/new
22
-
23
21
  def new
24
22
 
25
23
  end
26
24
 
27
25
 
28
26
 
29
- #post /password_resets == password_resets_path
30
-
31
- #params[:password_reset][:email] <=== User Input
32
-
33
27
  def create
34
28
 
35
29
  @user = User.find_by(email: params[:password_reset][:email].downcase)
@@ -56,29 +50,21 @@
56
50
 
57
51
 
58
52
 
59
- #get /password_resets/:id/edit?email=foo@bar.com
60
-
61
- #パスワードを入力してもらうとフォームを描画
62
-
63
53
  def edit
64
54
 
65
55
  end
66
56
 
67
57
 
68
58
 
69
- #patch /password_resets/:id?email=foo@bar.com
70
-
71
- #パスワードを再設定する
72
-
73
59
  def update
74
60
 
75
- if params[:user][:password].empty? # (3) への対応
61
+ if params[:user][:password].empty?
76
62
 
77
63
  @user.errors.add(:password, :blank)
78
64
 
79
65
  render 'edit'
80
66
 
81
- elsif @user.update_attributes(user_params) # (4) への対応
67
+ elsif @user.update_attributes(user_params)
82
68
 
83
69
  log_in @user
84
70
 
@@ -88,7 +74,7 @@
88
74
 
89
75
  else
90
76
 
91
- render 'edit' # (2) への対応
77
+ render 'edit'
92
78
 
93
79
  end
94
80
 
@@ -116,8 +102,6 @@
116
102
 
117
103
 
118
104
 
119
- #正しいユーザーかどうかを確認する
120
-
121
105
  def valid_user
122
106
 
123
107
  if not (@user && @user.activated? && @user.authenticated?(:reset, params[:id]))
@@ -132,8 +116,6 @@
132
116
 
133
117
 
134
118
 
135
- # トークンが期限切れかどうか確認する
136
-
137
119
  def check_expiration
138
120
 
139
121
  if @user.password_reset_expired?
@@ -174,16 +156,12 @@
174
156
 
175
157
  assert_template 'password_resets/new'
176
158
 
177
- # メールアドレスが無効
178
-
179
159
  post password_resets_path, params: { password_reset: { email: "" } }
180
160
 
181
161
  assert_not flash.empty?
182
162
 
183
163
  assert_template 'password_resets/new'
184
164
 
185
- # メールアドレスが有効
186
-
187
165
  post password_resets_path,
188
166
 
189
167
  params: { password_reset: { email: @user.email } }
@@ -196,18 +174,12 @@
196
174
 
197
175
  assert_redirected_to root_url
198
176
 
199
- # パスワード再設定フォームのテスト
200
-
201
177
  user = assigns(:user)
202
178
 
203
- # メールアドレスが無効
204
-
205
179
  get edit_password_reset_path(user.reset_token, email: "")
206
180
 
207
181
  assert_redirected_to root_url
208
182
 
209
- # 無効なユーザー
210
-
211
183
  user.toggle!(:activated)
212
184
 
213
185
  get edit_password_reset_path(user.reset_token, email: user.email)
@@ -216,22 +188,16 @@
216
188
 
217
189
  user.toggle!(:activated)
218
190
 
219
- # メールアドレスが有効で、トークンが無効
220
-
221
191
  get edit_password_reset_path('wrong token', email: user.email)
222
192
 
223
193
  assert_redirected_to root_url
224
194
 
225
- # メールアドレスもトークンも有効
226
-
227
195
  get edit_password_reset_path(user.reset_token, email: user.email)
228
196
 
229
197
  assert_template 'password_resets/edit'
230
198
 
231
199
  assert_select "input[name=email][type=hidden][value=?]", user.email
232
200
 
233
- # 無効なパスワードとパスワード確認
234
-
235
201
  patch password_reset_path(user.reset_token),
236
202
 
237
203
  params: { email: user.email,
@@ -242,8 +208,6 @@
242
208
 
243
209
  assert_select 'div#error_explanation'
244
210
 
245
- # パスワードが空
246
-
247
211
  patch password_reset_path(user.reset_token),
248
212
 
249
213
  params: { email: user.email,
@@ -254,8 +218,6 @@
254
218
 
255
219
  assert_select 'div#error_explanation'
256
220
 
257
- # 有効なパスワードとパスワード確認
258
-
259
221
  patch password_reset_path(user.reset_token),
260
222
 
261
223
  params: { email: user.email,
@@ -274,8 +236,18 @@
274
236
 
275
237
  end
276
238
 
239
+ ===============エラー内容=====================
240
+
241
+ FAIL["test_password_resets", PasswordResetsTest, 1.287856664000003]
242
+
243
+ test_password_resets#PasswordResetsTest (1.29s)
244
+
245
+ expecting <"password_resets/edit"> but rendering with <[]>
246
+
247
+ test/integration/password_resets_test.rb:39:in `block in <class:PasswordResetsTest>'
248
+
249
+
250
+
277
- ===============================================
251
+ =========================================
278
-
279
-
280
252
 
281
253
  どなたか宜しくお願い致します。