[Rspec]未解決：Dockerを導入後、Rspecでエラーが発生

#はじめに
dockerとdocker-composeを導入したはいいが、テストでめちゃくちゃエラーがでたので備忘として記録する

[追記]こちらの記事で解決方法を記載しております。
https://qiita.com/tochisuke221/items/374359eb3cff1182ed6c

#エラー内容

結合テストのみ例外なくエラーが発生

(一部抜粋)

```ruby
 47) Practices 投稿編集 投稿編集できないとき ログイン後、編集ページで、誤った情報が入力されているとエラー
      Failure/Error: url: ENV.fetch("SELENIUM_DRIVER_URL"),
      
      KeyError:
        key not found: "SELENIUM_DRIVER_URL"
      # ./spec/support/capybara.rb:7:in `fetch'
      # ./spec/support/capybara.rb:7:in `block (2 levels) in <main>'
```

#試したこと

おそらく自分が知らない知識として、「Docker上で結合テストを行うには環境構築が必要のなのだろう」と仮説を立てて、情報収集をおこなう。

[こちらの記事](https://qiita.com/ddpmntcpbr/items/752b6a43727e7cccdd56#capybara%E3%81%AE%E5%88%9D%E6%9C%9F%E8%A8%AD%E5%AE%9A)に行き着くも,一向に変化はなし。


なお、ローカル上では間違いなくテストは成功していたことを考えると、間違いなくDockerを導入したことが影響していると考えられるので、ここらへんを疑って引き続き考えていきたい

#コード

```Dockerfile
FROM ruby:2.6.5
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs yarn


WORKDIR /soccer_app
COPY Gemfile /soccer_app/Gemfile
COPY Gemfile.lock /soccer_app/Gemfile.lock
RUN gem install bundler
RUN bundle install
COPY . /soccer_app

RUN yarn install --check-files
RUN bundle exec rails webpacker:compile

```

```docker-compose.yml
version: "3"
services:
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: "password"
    ports:
      - "4306:3306"
  selenium_chrome:
    image: selenium/standalone-chrome-debug
    logging:
      driver: none
  web:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/soccer_app
    ports:
      - "3000:3000"
    depends_on:
      - db
    stdin_open: true
    tty: true
    environment:
      BASIC_AUTH_USER: ${BASIC_AUTH_USER:-default}
      BASIC_AUTH_PASSWORD: ${BASIC_AUTH_PASSWORD-default}

```


```Gemfile.
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'rspec-rails', '~> 4.0.0'
  gem 'factory_bot_rails'
  gem 'faker'
  gem 'rubocop', require: false
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'rubocop', require: false
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end





# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'devise'
gem 'pry-rails'
gem 'active_hash'
gem 'carrierwave', '~> 1.3', '>= 1.3.1'
gem 'mini_magick'
gem 'image_processing', '~> 1.2'
gem 'rails-i18n'
gem 'kaminari'
gem "gretel"
gem 'simple_calendar', '~> 2.0'
gem "aws-sdk-s3", require: false

```

```capybara.rb
require 'capybara/rspec'

RSpec.configure do |config|
  config.before(:each, type: :system) do
    driven_by :selenium, using: :headless_chrome, options: {
      browser: :remote,
      url: ENV.fetch("SELENIUM_DRIVER_URL"),
      desired_capabilities: :chrome
    }
    Capybara.server_host = 'web'
    Capybara.app_host='http://web'
  end
end

```

#おわりに
今回はまじで解決しなさそうな匂いがぷんぷんしますが、諦めず、前向きに取り組んでいきます！
はやくこの記事を解決済みに更新したいな〜