質問編集履歴

3

追記

2021/12/01 01:31

投稿

TA07
TA07

スコア1

test CHANGED
File without changes
test CHANGED
@@ -68,6 +68,10 @@
68
68
 
69
69
  ```
70
70
 
71
+ require 'rails_helper'
72
+
73
+
74
+
71
75
  RSpec.describe 'User', type: :model do
72
76
 
73
77
  it"has a valid factory"do

2

追記

2021/12/01 01:31

投稿

TA07
TA07

スコア1

test CHANGED
File without changes
test CHANGED
@@ -18,13 +18,21 @@
18
18
 
19
19
  ```
20
20
 
21
+ # bin/rspec spec/models/user_spec.rb
22
+
23
+ Running via Spring preloader in process 134
24
+
25
+ F
26
+
27
+
28
+
21
29
  Failures:
22
30
 
23
31
 
24
32
 
25
33
  1) User has a valid factory
26
34
 
27
- Failure/Error: expect(FactoryBot.build(:user)).tobe_valid
35
+ Failure/Error: expect(FactoryBot.build(:user)).to be_valid
28
36
 
29
37
 
30
38
 
@@ -38,7 +46,7 @@
38
46
 
39
47
 
40
48
 
41
- Finished in 0.05464 seconds (files took 1.12 seconds to load)
49
+ Finished in 0.08281 seconds (files took 1.82 seconds to load)
42
50
 
43
51
  1 example, 1 failure
44
52
 
@@ -64,7 +72,7 @@
64
72
 
65
73
  it"has a valid factory"do
66
74
 
67
- expect(FactoryBot.build(:user)).tobe_valid
75
+ expect(FactoryBot.build(:user)).to be_valid
68
76
 
69
77
  end
70
78
 
@@ -112,31 +120,7 @@
112
120
 
113
121
  require 'capybara/rspec'
114
122
 
115
- # Requires supporting ruby files with custom matchers and macros, etc, in
123
+
116
-
117
- # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
118
-
119
- # run as spec files by default. This means that files in spec/support that end
120
-
121
- # in _spec.rb will both be required and run as specs, causing the specs to be
122
-
123
- # run twice. It is recommended that you do not name files matching this glob to
124
-
125
- # end with _spec.rb. You can configure this pattern with the --pattern
126
-
127
- # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
128
-
129
- #
130
-
131
- # The following line is provided for convenience purposes. It has the downside
132
-
133
- # of increasing the boot-up time by auto-requiring all files in the support
134
-
135
- # directory. Alternatively, in the individual `*_spec.rb` files, manually
136
-
137
- # require only the support files necessary.
138
-
139
- #
140
124
 
141
125
  Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
142
126
 
@@ -228,36 +212,6 @@
228
212
 
229
213
  ```
230
214
 
231
- # This file was generated by the `rails generate rspec:install` command. Conventionally, all
232
-
233
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
234
-
235
- # The generated `.rspec` file contains `--require spec_helper` which will cause
236
-
237
- # this file to always be loaded, without a need to explicitly require it in any
238
-
239
- # files.
240
-
241
- #
242
-
243
- # Given that it is always loaded, you are encouraged to keep this file as
244
-
245
- # light-weight as possible. Requiring heavyweight dependencies from this file
246
-
247
- # will add to the boot time of your test suite on EVERY test run, even for an
248
-
249
- # individual file that may not need all of that loaded. Instead, consider making
250
-
251
- # a separate helper file that requires the additional dependencies and performs
252
-
253
- # the additional setup, and require it from the spec files that actually need
254
-
255
- # it.
256
-
257
- #
258
-
259
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
260
-
261
215
  RSpec.configure do |config|
262
216
 
263
217
  # rspec-expectations config goes here. You can use an alternate
@@ -422,7 +376,141 @@
422
376
 
423
377
  ```
424
378
 
425
-
379
+ ### 追記
380
+
381
+ `config/application.rb`
382
+
383
+ ```
384
+
385
+ config.time_zone = 'Tokyo'
386
+
387
+ config.generators.test_framework = :rspec
388
+
389
+ config.generators.system_tests = false
390
+
391
+ config.generators.stylesheets = false
392
+
393
+ config.generators.javascripts = false
394
+
395
+ config.generators.helper = false
396
+
397
+
398
+
399
+ config.generators do |g|
400
+
401
+ g.test_framework :rspec,
402
+
403
+ controller_specs: true,
404
+
405
+ model_specs: true,
406
+
407
+ request_spec: true,
408
+
409
+ view_specs: false,
410
+
411
+ helper_specs: false,
412
+
413
+ routing_specs: false
414
+
415
+ end
416
+
417
+ ```
418
+
419
+ `Gemfile`
420
+
421
+ ```
422
+
423
+ gem 'rails', '~> 6.1'
424
+
425
+ gem 'bootsnap', require: false
426
+
427
+ gem 'mysql2', '~> 0.5.3'
428
+
429
+ gem 'puma', '~> 5.2.2'
430
+
431
+ gem 'sass-rails', '~> 6.0'
432
+
433
+ gem 'uglifier', '>= 4.2.0'
434
+
435
+
436
+
437
+ gem 'jbuilder', '~> 2.11'
438
+
439
+
440
+
441
+ gem 'solidus', '~> 2.11.0'
442
+
443
+ gem 'solidus_auth_devise'
444
+
445
+ gem 'solidus_i18n', github: 'solidusio-contrib/solidus_i18n', branch: 'master'
446
+
447
+ gem 'paypalhttp', '~> 1.0'
448
+
449
+ gem 'solidus_auth_devise'
450
+
451
+ gem 'solidus_paypal_commerce_platform'
452
+
453
+
454
+
455
+ group :development, :test do
456
+
457
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
458
+
459
+ gem 'rspec-rails'
460
+
461
+ gem 'factory_bot_rails'
462
+
463
+ gem 'pry-rails'
464
+
465
+ gem 'pry-doc'
466
+
467
+ gem 'pry-byebug'
468
+
469
+ gem 'rails-erd'
470
+
471
+ gem 'annotate'
472
+
473
+ gem 'rubocop-airbnb'
474
+
475
+ gem 'spring-commands-rspec'
476
+
477
+ end
478
+
479
+
480
+
481
+ group :test do
482
+
483
+ gem 'capybara'
484
+
485
+ gem 'webdrivers'
486
+
487
+ gem 'launchy'
488
+
489
+ end
490
+
491
+
492
+
493
+ group :development do
494
+
495
+ gem 'web-console', '>= 4.1.0'
496
+
497
+ gem 'listen', '>= 3.0.5', '< 4.0'
498
+
499
+ gem 'spring'
500
+
501
+ gem 'spring-watcher-listen', '~> 2.0.1'
502
+
503
+ end
504
+
505
+
506
+
507
+ gem "aws-sdk", "~> 3.0"
508
+
509
+ gem "aws-sdk-s3", require: false
510
+
511
+ gem 'ast', '~> 2.4', '>= 2.4.2'
512
+
513
+ ```
426
514
 
427
515
  ### 試したこと
428
516
 

1

誤字

2021/12/01 01:17

投稿

TA07
TA07

スコア1

test CHANGED
File without changes
test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  ### 該当のソースコード
58
58
 
59
- `spec/modles/user_spec.rb`
59
+ `spec/models/user_spec.rb`
60
60
 
61
61
  ```
62
62