前提・実現したいこと
CircleCIでRspecを実行しようとしているものです.
Rspecで以下のようなエラーが出てしまい,そもそも実行されません.
解決策を提示していただけると幸いです.
発生している問題・エラーメッセージ
#!/bin/bash -eo pipefail dockerize -wait tcp://localhost:5432 -timeout 1m bundle exec rake db:schema:load 2021/09/08 17:32:40 Waiting for: tcp://localhost:5432 2021/09/08 17:32:40 Connected to tcp://localhost:5432 rake aborted! NoMethodError: undefined method `[]' for nil:NilClass /home/circleci/project/config/initializers/geocoder.rb:10:in `<main>' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `block in load' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:326:in `load' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/engine.rb:681:in `block in load_config_initializer' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/notifications.rb:205:in `instrument' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/engine.rb:680:in `load_config_initializer' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/engine.rb:634:in `block (2 levels) in <class:Engine>' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `each' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/engine.rb:633:in `block in <class:Engine>' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `instance_exec' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:32:in `run' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:61:in `block in run_initializers' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `each' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:50:in `tsort_each_child' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/initializable.rb:60:in `run_initializers' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/application.rb:384:in `initialize!' /home/circleci/project/config/environment.rb:5:in `<main>' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `block in require' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `require' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/application.rb:360:in `require_environment!' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/railties-6.1.3.2/lib/rails/application.rb:526:in `block in run_tasks_blocks' /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>' /usr/local/bin/bundle:23:in `load' /usr/local/bin/bundle:23:in `<main>' Tasks: TOP => db:schema:load => db:load_config => environment (See full trace by running task with --trace) Exited with code exit status 1 CircleCI received exit code 1
.circleci/config.yml
version: 2 jobs: build: docker: - image: circleci/ruby:2.6.3-node-browsers-legacy environment: RAILS_ENV: test POSTGRES_HOST: 127.0.0.1 TZ: "Japan" - image: circleci/postgres:9.4 environment: POSTGRES_USER: app_user_role POSTGRES_DB: study_support_app_test POSTGRES_PASSWORD: password # POSTGRES_HOST_AUTH_METHOD: 'trust' working_directory: ~/repo steps: - checkout - restore_cache: keys: - v1-dependencies-{{ checksum "Gemfile.lock" }} - v1-dependencies- - run: bundle install --jobs=4 --retry=3 --path vendor/bundle - save_cache: paths: - ./vendor/bundle key: v1-dependencies-{{ checksum "Gemfile.lock" }} - restore_cache: keys: - rails-demo-yarn-{{ checksum "yarn.lock" }} - rails-demo-yarn- - run: yarn install --ignore-engines - save_cache: key: rails-demo-yarn-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn # Rubocop - run: name: Rubocop command: bundle exec rubocop --fail-level W --display-only-fail-level-offenses - run: name: "waiting DB start" command: | dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: "initialize DB" command: | bundle exec rake db:create bundle exec rake db:migrate - run: name: rspec command: | bundle exec rspec --format RspecJunitFormatter \ --out test_results/rspec.xml \ --format documentation - store_test_results: path: test_results
補足情報(バージョン)
ruby: 2.6.3
Rails: 6.1.3.2
DB: psql (PostgreSQL) 13.3__イタリックテキスト__
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。