Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

ruby on rails - RSpec - An error occurred while loading - Did you mean?

I want to start with TDD, but I am having this error, I am working with rvm - ruby 3.0.0 and rails 6.1.1

An error occurred while loading ./spec/models/user_spec.rb. - Did you mean?
                rspec ./spec/spec_helper.rb

Failure/Error: require File.expand_path('../config/environment', __dir__)

LoadError:
  cannot load such file -- rexml/document
 /home/manci/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require'
 /home/manci/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.1/lib/active_support/dependencies.rb:332:in `block in require'
 /home/manci/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.1/lib/active_support/dependencies.rb:332:in `require'
 /home/manci/.rvm/gems/ruby-3.0.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/firefox.rb:22:in `<main>'
 /home/manci/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'

How to solve this issue?

question from:https://stackoverflow.com/questions/65894848/rspec-an-error-occurred-while-loading-did-you-mean

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found the solution here https://github.com/rspec/rspec-rails/issues/2441

For posterity, the latest versions (I think) of ruby and rails which you can (currently) use with rspec are:

ruby 2.7.2 rails 6.0.3


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...