Question

`require': cannot load such file -- mongo (LoadError)

Not sure why I am receiving this error. All the other gems that I use work fine. The top of my rspec test looks like:

require 'rubygems'
require 'spec_helper.rb'
require 'base64'
require 'json'
require 'bigdecimal'
require 'mysql2'
require 'mongo'

'mongo' however works in irb:

irb => require 'mongo'
true

When I use it in a script it also works. Just not in my rspec test. My file structure looks like: automation/test/spec/lib/test_spec.rb Though, it doesn't seem to matter where I run the test from. I am also using RVM, but like I said before all the other gems are working so I don't believe it to be a path issue.

For the versioning comparison here is a copy of my gem list:

bson (1.9.2)
bson_ext (1.9.2)
mongo (1.9.2)
rspec (2.14.1)
rspec-core (2.14.4)
rspec-expectations (2.14.0)
rspec-mocks (2.14.4, 2.14.1)
Was it helpful?

Solution

So looking further into 'bundler/setup' thanks to Matt I found when adding gem 'mongo' to my Gemfile seemed to fix the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top