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

質問編集履歴

4

test.logを追加

2019/10/13 10:58

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -55,4 +55,33 @@
55
55
  - got: nil
56
56
 
57
57
  # 困っていること
58
- patchでレコードを更新しているはずなのに、中身が空のままでテストが落ちてしまう。
58
+ patchでレコードを更新しているはずなのに、中身が空のままでテストが落ちてしまう。
59
+
60
+
61
+ ```test.log
62
+
63
+  (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
64
+  (0.4ms) SELECT `ar_internal_metadata`.`value` FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'schema_sha1'
65
+  (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
66
+  (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
67
+  (0.4ms) BEGIN
68
+  (0.4ms) SAVEPOINT active_record_1
69
+ User Exists? (0.4ms) SELECT 1 AS one FROM `users` WHERE `users`.`email` = BINARY 'hoge@mail.com' LIMIT 1
70
+ 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')
71
+  (0.4ms) RELEASE SAVEPOINT active_record_1
72
+ Started PATCH "/users/1" for 127.0.0.1 at 2019-10-13 10:57:06 +0000
73
+  (0.5ms) SAVEPOINT active_record_1
74
+ 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
75
+  (0.3ms) RELEASE SAVEPOINT active_record_1
76
+ Processing by UsersController#update as HTML
77
+ 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"}
78
+ User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
79
+ Unpermitted parameter: :id
80
+  (0.3ms) SAVEPOINT active_record_1
81
+ 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
82
+ 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
83
+  (0.4ms) ROLLBACK TO SAVEPOINT active_record_1
84
+ Redirected to http://www.example.com/users/1/profile
85
+ Completed 302 Found in 31ms (ActiveRecord: 4.1ms | Allocations: 15462)
86
+  (1.1ms) ROLLBACK
87
+ ```

3

試したことを追記

2019/10/13 10:58

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -39,7 +39,7 @@
39
39
 
40
40
 
41
41
  describe "PATCH / user_path" do
42
- context 'パラメータでacceptedがnilの時' do
42
+ context 'パラメータでの時' do
43
43
  let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09099998888', sex: '男性', birth_date: '2000-02-21', user_type_id: 1, image: '' } } }
44
44
 
45
45
  it 'リクエストが成功すること' do

2

追記の修正

2019/10/13 06:54

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
  describe "PATCH / user_path" do
42
42
  context 'パラメータでacceptedがnilの時' do
43
- let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09095336451', sex: '男性', birth_date: '1996-06-21', user_type_id: 1, image: '' } } }
43
+ let(:params_success) { { user: { lastname: 'last_name', firstname: 'first_name', tell: '09099998888', sex: '男性', birth_date: '2000-02-21', user_type_id: 1, image: '' } } }
44
44
 
45
45
  it 'リクエストが成功すること' do
46
46
  patch '/users/' + user.id.to_s, params: params_success

1

追記の修正

2019/10/13 06:53

投稿

nanase21
nanase21

スコア144

title CHANGED
File without changes
body CHANGED
@@ -21,7 +21,7 @@
21
21
  ```ruby
22
22
  FactoryBot.define do
23
23
  factory :user do
24
- email { 'funspo@mail.com'}
24
+ email { 'hoge@mail.com'}
25
25
  password { 'password' }
26
26
  password_confirmation { 'password' }
27
27
  accepted { true }