質問編集履歴

1

ソースコードを貼り付けてわかりやすくした。

2018/05/08 11:05

投稿

yutakanagashima
yutakanagashima

スコア14

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,16 @@
7
7
  rails チュートリアルの8章の終わりくらいで、rails t を実行すると以下のようなエラーが出ました。
8
8
 
9
9
  解決方法を具体的に(初心者です)教えていただけますか??
10
+
11
+
12
+
13
+
14
+
15
+ users_signup_test.rb のコードを以下に貼りました。
16
+
17
+
18
+
19
+
10
20
 
11
21
 
12
22
 
@@ -28,15 +38,97 @@
28
38
 
29
39
 
30
40
 
31
- ```ここに言語名を入力
32
41
 
33
- ソースコード
34
42
 
43
+ require 'test_helper'
44
+
45
+
46
+
47
+ class UsersSignupTest < ActionDispatch::IntegrationTest
48
+
49
+
50
+
51
+ test "invalid signup information" do
52
+
53
+ get signup_path
54
+
55
+ assert_no_difference 'User.count' do
56
+
57
+ post users_path, params: { user: { name: "",
58
+
59
+ email: "user@invalid",
60
+
61
+ password: "foo",
62
+
63
+ password_confirmation: "bar" } }
64
+
35
- ```
65
+ end
66
+
67
+ assert_template 'users/new'
68
+
69
+ assert_select 'div#<CSS id for error explanation>'
70
+
71
+ assert_select 'div.<CSS class for field with error>'
72
+
73
+
74
+
75
+
76
+
77
+ end
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+ test "valid signup information" do
86
+
87
+ get signup_path
88
+
89
+ assert_difference 'User.count', 1 do
90
+
91
+ post users_path, params: { user: { name: "Example User",
92
+
93
+ email: "user@example.com",
94
+
95
+ password: "password",
96
+
97
+ password_confirmation: "password" } }
98
+
99
+ end
100
+
101
+ follow_redirect!
102
+
103
+ assert_template 'users/show'
104
+
105
+ assert_not flash.empty?
106
+
107
+ end
108
+
109
+ end
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
36
122
 
37
123
 
38
124
 
39
125
  ### 試したこと
126
+
127
+
128
+
129
+
130
+
131
+ users_signup_test.rb のどこかがおかしいのかな〜と
40
132
 
41
133
 
42
134