質問編集履歴

1

該当コードの追加

2020/07/01 05:59

投稿

sakanafuto
sakanafuto

スコア0

test CHANGED
File without changes
test CHANGED
@@ -168,51 +168,9 @@
168
168
 
169
169
  Created database 'stelle_app_test'
170
170
 
171
- == 20200630041519 DeviseCreateUsers: migrating ================================
171
+
172
-
173
- -- create_table(:users)
172
+
174
-
175
- -> 0.0163s
173
+ 省略
176
-
177
- -- add_index(:users, :email, {:unique=>true})
178
-
179
- -> 0.0200s
180
-
181
- -- add_index(:users, :reset_password_token, {:unique=>true})
182
-
183
- -> 0.0120s
184
-
185
- == 20200630041519 DeviseCreateUsers: migrated (0.0485s) =======================
186
-
187
-
188
-
189
- == 20200630052243 CreatePrefectures: migrating ================================
190
-
191
- -- create_table(:prefectures)
192
-
193
- -> 0.0099s
194
-
195
- == 20200630052243 CreatePrefectures: migrated (0.0099s) =======================
196
-
197
-
198
-
199
- == 20200630052413 CreatePosts: migrating ======================================
200
-
201
- -- create_table(:posts)
202
-
203
- -> 0.0421s
204
-
205
- == 20200630052413 CreatePosts: migrated (0.0421s) =============================
206
-
207
-
208
-
209
- == 20200630053527 CreateLikes: migrating ======================================
210
-
211
- -- create_table(:likes)
212
-
213
- -> 0.0380s
214
-
215
- == 20200630053527 CreateLikes: migrated (0.0380s) =============================
216
174
 
217
175
 
218
176
 
@@ -258,33 +216,7 @@
258
216
 
259
217
  ** Invoke db:migrate (first_time)
260
218
 
261
- ** Invoke db:load_config (first_time)
262
-
263
- ** Invoke environment (first_time)
264
-
265
- ** Execute environment
266
-
267
- ** Execute db:load_config
268
-
269
- ** Execute db:migrate
270
-
271
- ** Invoke db:_dump (first_time)
272
-
273
- ** Execute db:_dump
219
+ 省略
274
-
275
- ** Invoke db:schema:dump (first_time)
276
-
277
- ** Invoke db:load_config
278
-
279
- ** Execute db:schema:dump
280
-
281
- ** Invoke set_annotation_options (first_time)
282
-
283
- ** Execute set_annotation_options
284
-
285
- ** Invoke annotate_models (first_time)
286
-
287
- ** Invoke set_annotation_options
288
220
 
289
221
  ** Invoke environment
290
222
 
@@ -622,4 +554,110 @@
622
554
 
623
555
 
624
556
 
557
+ ```Ruby
558
+
559
+ ./config/enviroment.rb
560
+
561
+
562
+
563
+ # Load the Rails application.
564
+
565
+ require_relative 'application'
566
+
567
+
568
+
569
+ # Initialize the Rails application.
570
+
571
+ Rails.application.initialize! #該当部分
572
+
573
+
574
+
575
+ ```
576
+
577
+
578
+
579
+ ```Ruby
580
+
581
+ ./spec/rails_helper.rb
582
+
583
+
584
+
585
+ require 'spec_helper'
586
+
587
+ ENV['RAILS_ENV'] ||= 'test'
588
+
589
+ require File.expand_path('../config/environment', __dir__) #該当部分
590
+
591
+ # Prevent database truncation if the environment is production
592
+
593
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
594
+
595
+ require 'rspec/rails'
596
+
597
+ ```
598
+
599
+
600
+
601
+ ```Ruby
602
+
603
+
604
+
605
+ ./spec/requests/users_request_spec
606
+
607
+
608
+
609
+ require 'rails_helper' #該当部分
610
+
611
+
612
+
613
+ RSpec.describe "Users", type: :request do
614
+
615
+
616
+
617
+ describe "GET /show" do
618
+
619
+ it "returns http success" do
620
+
621
+ get "/users/show"
622
+
623
+ expect(response).to have_http_status(:success)
624
+
625
+ end
626
+
627
+ end
628
+
629
+
630
+
631
+ describe "GET /index" do
632
+
633
+ it "returns http success" do
634
+
635
+ get "/users/index"
636
+
637
+ expect(response).to have_http_status(:success)
638
+
639
+ end
640
+
641
+ end
642
+
643
+
644
+
645
+ describe "GET /edit" do
646
+
647
+ it "returns http success" do
648
+
649
+ get "/users/edit"
650
+
651
+ expect(response).to have_http_status(:success)
652
+
653
+ end
654
+
655
+ end
656
+
657
+ end
658
+
659
+ ```
660
+
661
+
662
+
625
663
  なにか情報がありましたらお願いします。