質問編集履歴

2

誤字修正

2022/03/22 03:23

投稿

senseIY
senseIY

score261

test CHANGED
@@ -1 +1 @@
1
- Rspecで音声ファイルの設定が出来ず、user can't be blankが解消できない。
1
+ Rspecで音声ファイルの設定が出来ず、ActiveStorage::IntegrityError:が解消できない。
test CHANGED
File without changes

1

追記

2022/03/22 03:22

投稿

senseIY
senseIY

score261

test CHANGED
File without changes
test CHANGED
@@ -206,3 +206,38 @@
206
206
  https://ja.stackoverflow.com/questions/87956/rspec%e3%81%a7%e9%9f%b3%e5%a3%b0%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%81%8c%e5%87%ba%e6%9d%a5%e3%81%9a-user-cant-be-blank%e3%81%8c%e8%a7%a3%e6%b6%88%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84
207
207
 
208
208
  プログラミング入門者なので何かしら間違えた認識をしているかもしれません。何かしらアドバイスがあればよろしくお願いいたします。
209
+
210
+ ### 追記
211
+ https://insyokuprogram.com/2021/08/08/%E3%80%90ruby-on-rails%E3%80%91to-be-valid-but-got-errors-user-cant-be-blank-%E3%80%90rspec%E3%80%91%E3%81%8C%E8%A7%A3%E6%B1%BA%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%8B%E3%81%A3%E3%81%9F%E4%BB%B6/
212
+ こちらの方の記事を参考にさせていただき、buildと記述している部分をcreateに変更したところエラーが変化しました。
213
+ ```
214
+ An error occurred while loading ./spec/models/dictum_user_spec.rb.
215
+ Failure/Error: gogaku = FactoryBot.create(:gogaku, dictum_user: user)
216
+
217
+ ActiveStorage::IntegrityError:
218
+ ActiveStorage::IntegrityError
219
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/service/disk_service.rb:159:in `ensure_integrity_of'
220
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/service/disk_service.rb:22:in `block in upload'
221
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/service.rb:155:in `instrument'
222
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/service/disk_service.rb:20:in `upload'
223
+ # /usr/local/bundle/gems/activestorage-6.1.5/app/models/active_storage/blob.rb:253:in `upload_without_unfurling'
224
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/attached/changes/create_one.rb:26:in `upload'
225
+ # /usr/local/bundle/gems/activestorage-6.1.5/lib/active_storage/attached/model.rb:77:in `block in has_one_attached'
226
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/evaluation.rb:18:in `create'
227
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/strategy/create.rb:12:in `block in result'
228
+ # <internal:kernel>:90:in `tap'
229
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/strategy/create.rb:9:in `result'
230
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/factory.rb:43:in `run'
231
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/factory_runner.rb:29:in `block in run'
232
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/factory_runner.rb:28:in `run'
233
+ # /usr/local/bundle/gems/factory_bot-6.2.1/lib/factory_bot/strategy_syntax_method_registrar.rb:28:in `block in define_singular_strategy_method'
234
+ # ./spec/models/dictum_user_spec.rb:117:in `block (4 levels) in <top (required)>'
235
+ # ./spec/models/dictum_user_spec.rb:114:in `block (3 levels) in <top (required)>'
236
+ # ./spec/models/dictum_user_spec.rb:27:in `block (2 levels) in <top (required)>'
237
+ # ./spec/models/dictum_user_spec.rb:5:in `block in <top (required)>'
238
+ # ./spec/models/dictum_user_spec.rb:3:in `<top (required)>'
239
+
240
+ Finished in 0.00009 seconds (files took 1.79 seconds to load)
241
+ 0 examples, 0 failures, 1 error occurred outside of examples
242
+ ```
243
+ 現在ここでデバッグ中です。