質問するログイン新規登録

質問編集履歴

1

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

2018/05/08 11:05

投稿

yutakanagashima
yutakanagashima

スコア14

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,11 @@
4
4
  rails チュートリアルの8章の終わりくらいで、rails t を実行すると以下のようなエラーが出ました。
5
5
  解決方法を具体的に(初心者です)教えていただけますか??
6
6
 
7
+
8
+ users_signup_test.rb のコードを以下に貼りました。
9
+
10
+
11
+
7
12
  ### 発生している問題・エラーメッセージ
8
13
 
9
14
  Error:
@@ -13,12 +18,53 @@
13
18
 
14
19
  ### 該当のソースコード
15
20
 
16
- ```ここに言語名を入力
17
- ソースコード
18
- ```
19
21
 
22
+ require 'test_helper'
23
+
24
+ class UsersSignupTest < ActionDispatch::IntegrationTest
25
+
26
+ test "invalid signup information" do
27
+ get signup_path
28
+ assert_no_difference 'User.count' do
29
+ post users_path, params: { user: { name: "",
30
+ email: "user@invalid",
31
+ password: "foo",
32
+ password_confirmation: "bar" } }
33
+ end
34
+ assert_template 'users/new'
35
+ assert_select 'div#<CSS id for error explanation>'
36
+ assert_select 'div.<CSS class for field with error>'
37
+
38
+
39
+ end
40
+
41
+
42
+
43
+ test "valid signup information" do
44
+ get signup_path
45
+ assert_difference 'User.count', 1 do
46
+ post users_path, params: { user: { name: "Example User",
47
+ email: "user@example.com",
48
+ password: "password",
49
+ password_confirmation: "password" } }
50
+ end
51
+ follow_redirect!
52
+ assert_template 'users/show'
53
+ assert_not flash.empty?
54
+ end
55
+ end
56
+
57
+
58
+
59
+
60
+
61
+
62
+
20
63
  ### 試したこと
21
64
 
65
+
66
+ users_signup_test.rb のどこかがおかしいのかな〜と
67
+
22
68
  色々とググりましたがわからずです・・・。
23
69
 
24
70
  ### 補足情報(FW/ツールのバージョンなど)