閲覧ありがとうございます!
現在、railsにてオリジナルアプリを開発中なのですが、rspecが起動せず詰まっております。
エラー内容を見る限り、require 'capybara/rspec'が読み込まれていないことが原因であることが推測できたのですが、解決することができませんでした。。。
環境は下記になります。
・mac os
・ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
・rails -v
Rails 6.0.3.4
・rspec -v
RSpec 3.10
- rspec-core 3.10.0
- rspec-expectations 3.10.0
- rspec-mocks 3.10.0
- rspec-support 3.10.0
何卒、よろしくお願いいたします。
terminal
1bin/rspec 2 3An error occurred while loading ./spec/helpers/application_helper_spec.rb. 4Failure/Error: require 'capybara/rspec' 5 6LoadError: 7 cannot load such file -- capybara/rspec 8# ./spec/rails_helper.rb:1:in `<top (required)>' 9# ./spec/helpers/application_helper_spec.rb:1:in `<top (required)>' 10 11An error occurred while loading ./spec/requests/static_pages_spec.rb. - Did you mean? 12 rspec ./spec/system/static_pages_spec.rb 13 14Failure/Error: require 'capybara/rspec' 15 16LoadError: 17 cannot load such file -- capybara/rspec 18# ./spec/rails_helper.rb:1:in `<top (required)>' 19# ./spec/requests/static_pages_spec.rb:1:in `<top (required)>' 20 21An error occurred while loading ./spec/system/static_pages_spec.rb. - Did you mean? 22 rspec ./spec/requests/static_pages_spec.rb 23 24Failure/Error: require 'capybara/rspec' 25 26LoadError: 27 cannot load such file -- capybara/rspec 28# ./spec/rails_helper.rb:1:in `<top (required)>' 29# ./spec/system/static_pages_spec.rb:1:in `<top (required)>' 30No examples found. 31 32Finished in 0.00003 seconds (files took 0.12944 seconds to load) 330 examples, 0 failures, 3 errors occurred outside of examples
spec/rails_helper.rb
require 'capybara/rspec' require 'spec_helper' Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rspec/rails' begin ActiveRecord::Migration.maintain_test_schema! rescue ActiveRecord::PendingMigrationError => e puts e.to_s.strip exit 1 end RSpec.configure do |config| config.include Devise::Test::IntegrationHelpers, type: :system config.fixture_path = "#{::Rails.root}/spec/fixtures" config.use_transactional_fixtures = true config.infer_spec_type_from_file_location! config.filter_rails_from_backtrace! end
Gemfile
1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '2.6.6' 5 6gem 'rails', '~> 6.0.3', '>= 6.0.3.3' 7gem 'puma', '~> 4.1' 8gem 'sass-rails', '>= 6' 9gem 'webpacker', '~> 4.0' 10gem 'turbolinks', '~> 5' 11gem 'jbuilder', '~> 2.7' 12gem 'bootsnap' 13gem 'bootstrap-sass' 14gem 'devise' 15 16group :development, :test do 17 gem 'sqlite3', '~> 1.4' 18 gem 'rails-controller-testing' 19 gem 'rspec-rails' 20 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 21end 22 23group :development do 24 gem 'spring-commands-rspec' 25 gem 'web-console', '>= 3.3.0' 26 gem 'listen', '~> 3.2' 27 gem 'spring' 28 gem 'spring-watcher-listen', '~> 2.0.0' 29end 30 31group :test do 32 gem 'webdrivers' 33 gem 'capybara', '>= 2.15' 34 gem 'selenium-webdriver' 35 gem 'webdrivers' 36end 37 38group :production do 39 gem 'pg' 40end 41 42gem 'tzinfo-data'
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。