質問編集履歴
3
質問を少し変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
こんにちは。
|
1
|
+
こんにちは。
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
rails チュートリアルの10章の10の2の最後らへんで、 rails t を実行したら
|
5
|
+
rails チュートリアルの10章の10の2の最後らへんで、 rails t を実行したら以下のようなエラーが出て困っております。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
6
12
|
|
7
13
|
|
8
14
|
|
@@ -22,7 +28,7 @@
|
|
22
28
|
|
23
29
|
|
24
30
|
|
25
|
-
|
31
|
+
|
26
32
|
|
27
33
|
|
28
34
|
|
@@ -34,14 +40,16 @@
|
|
34
40
|
|
35
41
|
|
36
42
|
|
43
|
+
(自分でやったこと)
|
37
44
|
|
38
45
|
|
39
46
|
|
40
47
|
|
41
48
|
|
49
|
+
色々手順を飛ばしていないかをチュートリアルで確認。
|
42
50
|
|
43
|
-
|
51
|
+
そして、エラーコードをググってもわからず、ここで質問させてください。
|
44
52
|
|
45
53
|
|
46
54
|
|
47
|
-
|
55
|
+
具体的にどのようにファイルを編集すれば解決するでしょうか??
|
2
コード更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,159 +28,13 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
10章で、user login test なんか触っていないぞ??
|
31
|
+
10章で、user login test なんか触っていないぞ??と思いました。
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
ちなみに、users_login_test.rb は
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
require 'test_helper'
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
class UsersLoginTest < ActionDispatch::IntegrationTest
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
def setup
|
52
|
-
|
53
|
-
@user = users(:michael)
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
test "login with invalid information" do
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
get login_path
|
68
|
-
|
69
|
-
assert_template 'sessions/new'
|
70
|
-
|
71
|
-
post login_path, params: { session: { email: "", password: "" } }
|
72
|
-
|
73
|
-
assert_template 'sessions/new'
|
74
|
-
|
75
|
-
assert_not flash.empty?
|
76
|
-
|
77
|
-
get root_path
|
78
|
-
|
79
|
-
assert flash.empty?
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
test "login with valid information followed by logout" do
|
96
|
-
|
97
|
-
get login_path
|
98
|
-
|
99
|
-
post login_path, params: { session: { email: @user.email,
|
100
|
-
|
101
|
-
password: 'password' } }
|
102
|
-
|
103
|
-
assert is_logged_in?
|
104
|
-
|
105
|
-
assert_redirected_to @user
|
106
|
-
|
107
|
-
follow_redirect!
|
108
|
-
|
109
|
-
assert_template 'users/show'
|
110
|
-
|
111
|
-
assert_select "a[href=?]", login_path, count: 0
|
112
|
-
|
113
|
-
assert_select "a[href=?]", logout_path
|
114
|
-
|
115
|
-
assert_select "a[href=?]", user_path(@user)
|
116
|
-
|
117
|
-
delete logout_path
|
118
|
-
|
119
|
-
assert_not is_logged_in?
|
120
|
-
|
121
|
-
assert_redirected_to root_url
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
# 2番目のウィンドウでログアウトをクリックするユーザーをシミュレートする
|
126
|
-
|
127
|
-
delete logout_path
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
follow_redirect!
|
132
|
-
|
133
|
-
assert_select "a[href=?]", login_path
|
134
|
-
|
135
|
-
assert_select "a[href=?]", logout_path, count: 0
|
136
|
-
|
137
|
-
assert_select "a[href=?]", user_path(@user), count: 0
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
test "login with remembering" do
|
146
|
-
|
147
|
-
log_in_as(@user, remember_me: '1')
|
148
|
-
|
149
|
-
assert_equal cookies['remember_token'], assigns(:user).remember_token
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
test "login without remembering" do
|
156
|
-
|
157
|
-
# クッキーを保存してログイン
|
158
|
-
|
159
|
-
log_in_as(@user, remember_me: '1')
|
160
|
-
|
161
|
-
delete logout_path
|
162
|
-
|
163
|
-
# クッキーを削除してログイン
|
164
|
-
|
165
|
-
log_in_as(@user, remember_me: '0')
|
166
|
-
|
167
|
-
assert_empty cookies['remember_token']
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
end
|
176
32
|
|
177
33
|
|
178
34
|
|
179
35
|
|
180
36
|
|
181
37
|
|
182
|
-
|
183
|
-
って感じです
|
184
38
|
|
185
39
|
|
186
40
|
|
1
コード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,161 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
+
|
36
|
+
|
37
|
+
ちなみに、users_login_test.rb は
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
require 'test_helper'
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
class UsersLoginTest < ActionDispatch::IntegrationTest
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
def setup
|
52
|
+
|
53
|
+
@user = users(:michael)
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
test "login with invalid information" do
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
get login_path
|
68
|
+
|
69
|
+
assert_template 'sessions/new'
|
70
|
+
|
71
|
+
post login_path, params: { session: { email: "", password: "" } }
|
72
|
+
|
73
|
+
assert_template 'sessions/new'
|
74
|
+
|
75
|
+
assert_not flash.empty?
|
76
|
+
|
77
|
+
get root_path
|
78
|
+
|
79
|
+
assert flash.empty?
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
test "login with valid information followed by logout" do
|
96
|
+
|
97
|
+
get login_path
|
98
|
+
|
99
|
+
post login_path, params: { session: { email: @user.email,
|
100
|
+
|
101
|
+
password: 'password' } }
|
102
|
+
|
103
|
+
assert is_logged_in?
|
104
|
+
|
105
|
+
assert_redirected_to @user
|
106
|
+
|
107
|
+
follow_redirect!
|
108
|
+
|
109
|
+
assert_template 'users/show'
|
110
|
+
|
111
|
+
assert_select "a[href=?]", login_path, count: 0
|
112
|
+
|
113
|
+
assert_select "a[href=?]", logout_path
|
114
|
+
|
115
|
+
assert_select "a[href=?]", user_path(@user)
|
116
|
+
|
117
|
+
delete logout_path
|
118
|
+
|
119
|
+
assert_not is_logged_in?
|
120
|
+
|
121
|
+
assert_redirected_to root_url
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
# 2番目のウィンドウでログアウトをクリックするユーザーをシミュレートする
|
126
|
+
|
127
|
+
delete logout_path
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
follow_redirect!
|
132
|
+
|
133
|
+
assert_select "a[href=?]", login_path
|
134
|
+
|
135
|
+
assert_select "a[href=?]", logout_path, count: 0
|
136
|
+
|
137
|
+
assert_select "a[href=?]", user_path(@user), count: 0
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
test "login with remembering" do
|
146
|
+
|
147
|
+
log_in_as(@user, remember_me: '1')
|
148
|
+
|
149
|
+
assert_equal cookies['remember_token'], assigns(:user).remember_token
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
test "login without remembering" do
|
156
|
+
|
157
|
+
# クッキーを保存してログイン
|
158
|
+
|
159
|
+
log_in_as(@user, remember_me: '1')
|
160
|
+
|
161
|
+
delete logout_path
|
162
|
+
|
163
|
+
# クッキーを削除してログイン
|
164
|
+
|
165
|
+
log_in_as(@user, remember_me: '0')
|
166
|
+
|
167
|
+
assert_empty cookies['remember_token']
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
って感じです
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
35
|
-
|
189
|
+
色々手順を飛ばしていないかを調べたりググってもわからず、ここで質問させてください。
|
36
190
|
|
37
191
|
|
38
192
|
|