我正在将mongoid-rspec与Mongoid 7集成,并在运行命令rspec时向我显示下面提到的错误跟踪:
cannot load such file -- mongoid/relations
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/mongoid-rspec-4.0.0/lib/matchers/associations.rb:1:in `<top (required)>'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/mongoid-rspec-4.0.0/lib/mongoid/rspec.rb:13:in `<top (required)>'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@wavedio/gems/mongoid-rspec-4.0.0/lib/mongoid-rspec.rb:1:in `<top (required)>'
# /home/xxxxxxxx/.rvm/gems/ruby-2.4.1@global/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
Configured mongoid-rspec using this link https://github.com/mongoid/mongoid-rspec
Rails - 5.1.6
Ruby - 2.4.1
答案 0 :(得分:0)
是的,最新发布的mongoid-rspec
4.0.0版本不支持mongoid 7,截至目前。见这里:https://github.com/mongoid/mongoid-rspec/pull/212。
我在我的项目中使用它:
gem 'mongoid-rspec', github: 'mongoid/mongoid-rspec', ref: '68c95b133be1a1482fe882e39afd33262147d1f4'
它对我有用。