ruby on rails - Confused - spec_helper.rb:94:in `<top (required)>': uninitialized constant Shoulda (NameError) -
i working on project rails 4 & mongoid 4. trying set shoulda-matchers (version 2.8.0), following thoughtbot/shoulda-matchers, points readme called readme 2.8.0. , hoping use mongoid-rspec testing.
however keep getting spec_helper.rb:94:in '<top (required)>': uninitialized constant shoulda (nameerror)
i added in gemfile
: following thoughtbot/shoulda-matchers
group :test gem 'shoulda-matchers' end
i added in spec_helper.rb
(which error comes from) - following thoughtbot/shoulda-matchers
shoulda::matchers.configure |config| config.integrate |with| with.test_framework :rspec with.library :rails end end
i have tried googling there no direct solution (or there no direct problem this). added require: false
in gemfile, following readme 2.8.0
group :test gem 'shoulda-matchers', require: false end
i added require 'shoulda/matchers'
in rails_helper.rb
. order of 'requires' this:
require 'spec_helper' require 'rspec/rails' require 'shoulda/matchers'
require 'rspec/rails' below require 'spec_helper' default. , readme provided on github page, should place shoulda\matcher
below 'rspec/rails'. have tried place require 'shoulda/matchers'
on top of require 'spec_helper'
didn't work.
my versions:
rails 4.2.1 ruby 2.2.1 mongoid ~ 4.0.0 rspec-rails ~ 3.0 mongoid-rspec ~ 2.1.0 shoulda-matchers 2.8.0
i appreciate help.
from link provided:
note: new configuration syntax isn't available in public release yet -- please refer readme 2.8.0 current installation instructions.
that note master branch. current release (2.8.0) has different set of documentation. confusing, know.
just remove configuration section spec/spec_helper.rb
, should rainbows , unicorns once again.
Comments
Post a Comment