質問編集履歴
1
テストについての補足を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -54,4 +54,26 @@
|
|
54
54
|
|
55
55
|
### 補足情報(FW/ツールのバージョンなど)
|
56
56
|
|
57
|
-
|
57
|
+
以下のようなテストを書いており、
|
58
|
+
|
59
|
+
test "login with valid information followed by logout" do
|
60
|
+
get login_path
|
61
|
+
post login_path, params: { session: { email: @user.email,
|
62
|
+
password: 'password' } }
|
63
|
+
assert is_logged_in?
|
64
|
+
assert_redirected_to @user
|
65
|
+
follow_redirect!
|
66
|
+
assert_template 'users/show'
|
67
|
+
assert_select "a[href=?]", login_path, count: 0
|
68
|
+
assert_select "a[href=?]", logout_path
|
69
|
+
assert_select "a[href=?]", user_path(@user)
|
70
|
+
delete logout_path
|
71
|
+
assert_not is_logged_in?
|
72
|
+
assert_redirected_to root_url
|
73
|
+
follow_redirect!
|
74
|
+
assert_select "a[href=?]", login_path
|
75
|
+
assert_select "a[href=?]", logout_path, count: 0
|
76
|
+
assert_select "a[href=?]", user_path(@user), count: 0
|
77
|
+
end
|
78
|
+
|
79
|
+
logoutボタンを押した後にリダイレクトに失敗している(?)ため、このテストは本来であればREDになると思うのですが、なぜかGREENで通ってしまいます。
|