Rspec V3报错TypeError:参数类型错误,路径相关问题未解决
求助:RSpec 3报错
TypeError: wrong argument type Class (expected Module) 最近在跑RSpec 3测试的时候卡壳了,碰到这么个错误:
Failure/Error: require 'rspec/rails'
TypeError: wrong argument type Class (expected Module)
我知道这个错误挺常见的,但翻了好多资料都没找到问题根源,感觉大概率是路径配置的锅。目前涉及到的文件有这些:
Gemfilespec/factories/user.rbspec/models/user_spec.rbspec/support/factory_bot.rb.rspecrails_helper.rb
我执行的测试命令是:
bundle exec rspec spec/models/user_spec.rb
已经试过这些操作,但都没解决:
- 在
rails_helper.rb里的require 'rspec/rails'下面手动加了require 'support/factory_bot' - 重新执行了
rails generate rspec:install,过程是成功的 - 试过用
rspec -v确认RSpec版本,确保是3.x系列
内容的提问来源于stack exchange,提问作者Imran Ahmad
相关产品推荐
相关产品推荐

