質問編集履歴

2

不要な記述の削除

2019/12/19 14:39

投稿

k-810
k-810

スコア192

test CHANGED
File without changes
test CHANGED
@@ -108,69 +108,7 @@
108
108
 
109
109
  ```
110
110
 
111
- ###### Dockerfile
111
+
112
-
113
-
114
-
115
- ```
116
-
117
- FROM node:10.13.0 as node
118
-
119
- FROM ruby:2.5.0
120
-
121
-
122
-
123
- ENV ENTRYKIT_VERSION 0.4.0
124
-
125
-
126
-
127
- RUN wget https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
128
-
129
- && tar -xvzf entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
130
-
131
- && rm entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \
132
-
133
- && mv entrykit /bin/entrykit \
134
-
135
- && chmod +x /bin/entrykit \
136
-
137
- && entrykit --symlink
138
-
139
-
140
-
141
- ENV YARN_VERSION 1.10.1
142
-
143
-
144
-
145
- COPY --from=node /opt/yarn-v$YARN_VERSION /opt/yarn
146
-
147
- COPY --from=node /usr/local/bin/node /usr/local/bin/
148
-
149
-
150
-
151
- RUN ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
152
-
153
- && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg
154
-
155
-
156
-
157
- WORKDIR /app
158
-
159
-
160
-
161
- RUN bundle config build.nokogiri --use-system-libraries
162
-
163
-
164
-
165
- ENTRYPOINT [ \
166
-
167
- "prehook", "bundle install -j3", "--", \
168
-
169
- "prehook", "yarn install", "--"]
170
-
171
-
172
-
173
- ```
174
112
 
175
113
 
176
114
 
@@ -299,101 +237,3 @@
299
237
 
300
238
 
301
239
  ```
302
-
303
-
304
-
305
- ###### spec_helper.rb
306
-
307
- ```
308
-
309
- require 'simplecov'
310
-
311
-
312
-
313
- RSpec.configure do |config|
314
-
315
- ENV['RAILS_ENV'] = 'test'
316
-
317
- config.expect_with :rspec do |expectations|
318
-
319
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
320
-
321
- end
322
-
323
-
324
-
325
- config.mock_with :rspec do |mocks|
326
-
327
- mocks.verify_partial_doubles = true
328
-
329
- end
330
-
331
- config.shared_context_metadata_behavior = :apply_to_host_groups
332
-
333
- config.before(:all) do
334
-
335
- FactoryBot.reload
336
-
337
- end
338
-
339
- if ENV['CIRCLE_ARTIFACTS']
340
-
341
- dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
342
-
343
- SimpleCov.coverage_dir(dir)
344
-
345
- end
346
-
347
-
348
-
349
- SimpleCov.start
350
-
351
- end
352
-
353
-
354
-
355
- ```
356
-
357
-
358
-
359
- ### 試したこと①
360
-
361
- spec_helper.rbの ENV['RAILS_ENV'] = 'test' をコメントアウトしたら実行できます(ただしdevelop環境での実行になってしまいます)
362
-
363
-
364
-
365
- ### 試したこと②
366
-
367
- https://shinkufencer.hateblo.jp/entry/2018/11/06/225439
368
-
369
- こちらを参考にspec/rails_helper.rbにあった
370
-
371
- ```
372
-
373
- begin
374
-
375
- ActiveRecord::Migration.maintain_test_schema!
376
-
377
- rescue ActiveRecord::PendingMigrationError => e
378
-
379
- puts e.to_s.strip
380
-
381
- exit 1
382
-
383
- end
384
-
385
- ```
386
-
387
- をそのままコメントアウトしたあとに再び$docker-compose run web rspecを実行したら以下のエラーが出ました
388
-
389
- ```
390
-
391
- Failure/Error: connect user, pass, host, port, database, socket, flags, conn_attrs
392
-
393
-
394
-
395
- Mysql2::Error::ConnectionError:
396
-
397
- Access denied for user 'app_name'@'%' to database 'app_name_test'
398
-
399
- ```

1

追記

2019/12/19 14:39

投稿

k-810
k-810

スコア192

test CHANGED
File without changes
test CHANGED
@@ -356,6 +356,44 @@
356
356
 
357
357
 
358
358
 
359
- ### 試したこと
359
+ ### 試したこと
360
360
 
361
361
  spec_helper.rbの ENV['RAILS_ENV'] = 'test' をコメントアウトしたら実行できます(ただしdevelop環境での実行になってしまいます)
362
+
363
+
364
+
365
+ ### 試したこと②
366
+
367
+ https://shinkufencer.hateblo.jp/entry/2018/11/06/225439
368
+
369
+ こちらを参考にspec/rails_helper.rbにあった
370
+
371
+ ```
372
+
373
+ begin
374
+
375
+ ActiveRecord::Migration.maintain_test_schema!
376
+
377
+ rescue ActiveRecord::PendingMigrationError => e
378
+
379
+ puts e.to_s.strip
380
+
381
+ exit 1
382
+
383
+ end
384
+
385
+ ```
386
+
387
+ をそのままコメントアウトしたあとに再び$docker-compose run web rspecを実行したら以下のエラーが出ました
388
+
389
+ ```
390
+
391
+ Failure/Error: connect user, pass, host, port, database, socket, flags, conn_attrs
392
+
393
+
394
+
395
+ Mysql2::Error::ConnectionError:
396
+
397
+ Access denied for user 'app_name'@'%' to database 'app_name_test'
398
+
399
+ ```