質問編集履歴

4

test.logを追加

2019/10/13 10:58

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -113,3 +113,61 @@
113
113
  # 困っていること
114
114
 
115
115
  patchでレコードを更新しているはずなのに、中身が空のままでテストが落ちてしまう。
116
+
117
+
118
+
119
+
120
+
121
+ ```test.log
122
+
123
+
124
+
125
+  (0.4ms) SET NAMES utf8 COLLATE utf8_general_ci, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
126
+
127
+  (0.4ms) SELECT `ar_internal_metadata`.`value` FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'schema_sha1'
128
+
129
+  (0.3ms) SET NAMES utf8 COLLATE utf8_general_ci, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
130
+
131
+  (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
132
+
133
+  (0.4ms) BEGIN
134
+
135
+  (0.4ms) SAVEPOINT active_record_1
136
+
137
+ User Exists? (0.4ms) SELECT 1 AS one FROM `users` WHERE `users`.`email` = BINARY 'hoge@mail.com' LIMIT 1
138
+
139
+ User Create (0.7ms) INSERT INTO `users` (`id`, `email`, `encrypted_password`, `confirmed_at`, `created_at`, `updated_at`, `accepted`, `promotion_code`) VALUES (1, 'hoge@mail.com', '$2a$04$4bYXcGJzKQDHBEvXzzzbSulv3URSCxygq6dJNtTshhAY199MNvFG6', '2019-10-13 00:00:00', '2019-10-13 10:57:06.721754', '2019-10-13 10:57:06.721754', TRUE, '12345')
140
+
141
+  (0.4ms) RELEASE SAVEPOINT active_record_1
142
+
143
+ Started PATCH "/users/1" for 127.0.0.1 at 2019-10-13 10:57:06 +0000
144
+
145
+  (0.5ms) SAVEPOINT active_record_1
146
+
147
+ User Update (0.5ms) UPDATE `users` SET `users`.`sign_in_count` = 1, `users`.`current_sign_in_at` = '2019-10-13 10:57:06', `users`.`last_sign_in_at` = '2019-10-13 10:57:06', `users`.`current_sign_in_ip` = '127.0.0.1', `users`.`last_sign_in_ip` = '127.0.0.1', `users`.`updated_at` = '2019-10-13 10:57:06.738645' WHERE `users`.`id` = 1
148
+
149
+  (0.3ms) RELEASE SAVEPOINT active_record_1
150
+
151
+ Processing by UsersController#update as HTML
152
+
153
+ Parameters: {"user"=>{"id"=>"1", "lastname"=>"last_name", "firstname"=>"first_name", "tell"=>"09088997766", "sex"=>"男性", "birth_date"=>"1996-04-21", "user_type_id"=>"1", "image"=>""}, "id"=>"1"}
154
+
155
+ User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
156
+
157
+ Unpermitted parameter: :id
158
+
159
+  (0.3ms) SAVEPOINT active_record_1
160
+
161
+ User Update (0.4ms) UPDATE `users` SET `users`.`updated_at` = '2019-10-13 10:57:06.770118', `users`.`firstname` = 'first_name', `users`.`lastname` = 'last_name', `users`.`tell` = '09088997766', `users`.`sex` = '男性', `users`.`birth_date` = '1996-04-21', `users`.`user_type_id` = 1 WHERE `users`.`id` = 1
162
+
163
+ ActiveStorage::Blob Load (0.5ms) SELECT `active_storage_blobs`.* FROM `active_storage_blobs` INNER JOIN `active_storage_attachments` ON `active_storage_blobs`.`id` = `active_storage_attachments`.`blob_id` WHERE `active_storage_attachments`.`record_id` = 1 AND `active_storage_attachments`.`record_type` = 'User' AND `active_storage_attachments`.`name` = 'image' LIMIT 1
164
+
165
+  (0.4ms) ROLLBACK TO SAVEPOINT active_record_1
166
+
167
+ Redirected to http://www.example.com/users/1/profile
168
+
169
+ Completed 302 Found in 31ms (ActiveRecord: 4.1ms | Allocations: 15462)
170
+
171
+  (1.1ms) ROLLBACK
172
+
173
+ ```

3

試したことを追記

2019/10/13 10:58

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  describe "PATCH / user_path" do
82
82
 
83
- context 'パラメータでacceptedがnilの時' do
83
+ context 'パラメータでの時' do
84
84
 
85
85
  let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09099998888', sex: '男性', birth_date: '2000-02-21', user_type_id: 1, image: '' } } }
86
86
 

2

追記の修正

2019/10/13 06:54

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -82,7 +82,7 @@
82
82
 
83
83
  context 'パラメータでacceptedがnilの時' do
84
84
 
85
- let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09095336451', sex: '男性', birth_date: '1996-06-21', user_type_id: 1, image: '' } } }
85
+ let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09099998888', sex: '男性', birth_date: '2000-02-21', user_type_id: 1, image: '' } } }
86
86
 
87
87
 
88
88
 

1

追記の修正

2019/10/13 06:53

投稿

nanase21
nanase21

スコア144

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  factory :user do
46
46
 
47
- email { 'funspo@mail.com'}
47
+ email { 'hoge@mail.com'}
48
48
 
49
49
  password { 'password' }
50
50