開発環境
Windows10
ruby 2.3.3
rails 5.2.2
testをしたかったのだができなかった。
本当はもっと長いエラーが出ましたが必要なところだけ抜粋。
C:\Users\myapp>rails test test/controllers/home_controller_test.rb:7
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'chromedriver-helper'. (Bundler::GemRequireError)
Gem Load Error is: not executable: "C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/chromedriver-helper-2.1.0/bin/chromedriver-helper"
Backtrace for gem load error is:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/common/platform.rb:135:in `assert_executable'
Gemfileのgem 'chromedriver-helper'に問題がありそう。
Gemfile
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end
rails gで作成したGemfileがminitestになってなかったので書き直した。
Gemfile
group :test do
gem 'minitest', '~> 5.10', '!= 5.10.2'
gem 'rails-controller-testing'
end
コマンドプロンプトで$ bundle installを実行
※$ bundle updateはだめ。
C:\Users\myapp>rails test test/controllers/home_controller_test.rb:7
Run options: --seed 39779
# Running:
.
Finished in 3.282664s, 0.3046 runs/s, 2.7417 assertions/s.
1 runs, 9 assertions, 0 failures, 0 errors, 0 skips
できた。わーい(*'▽')