我正在尝试将RSpec测试框架用于rails5。我已经将“ rspec-rails” gem安装到我的gem文件中并安装了它。
这是.gem文件。
group :development, :test do
gem 'rspec-rails', '~> 3.8'
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
在运行“ rails generate rspec:install”命令的第二步中,出现以下错误。
错误
/Library/Ruby/Gems/2.3.0/gems/bootsnap-
1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block
in load_missing_constant': uninitialized constant
RSpec::Rails::Application (NameError)
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-
1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in
`without_bootsnap_cache'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-
1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in
`rescue in load_missing_constant'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-
1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in
`load_missing_constant'
from /.../.../..../Project/config/application.rb:21:in `<module:RSpec>'
from /.../.../.../Project/config/application.rb:20:in `<top (required)>'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:92:in `require'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:92:in `preload'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:153:in `serve'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:141:in `block in run'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:135:in `loop'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application.rb:135:in `run'
from /Library/Ruby/Gems/2.3.0/gems/spring-
2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby
/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
application.rb文件
require_relative 'boot'
require "rails"
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
require "sprockets/railtie"
Bundler.require(*Rails.groups)
module RSpec
class Application < Rails::Application
config.load_defaults 5.2
config.generators.system_tests = nil
end
end
../ config / application.rb文件中是否有需要“需要”的内容?