testing my Ruby gem: undefined method `configure' for Shoulda::Matchers:Module (NoMethodError) -
i'm working on first ruby gem , have bundled cucumber, rspec , shoulda-matches testing. when run rspec, following error:
/app/my_gem/spec/spec_helper.rb:6:in `<top (required)>': undefined method `configure' shoulda::matchers:module (nomethoderror)
here gemspec:
# my_gem.gemspec ... gem::specification.new |spec| ... ... spec.add_development_dependency "activemodel" spec.add_development_dependency "bundler", "~> 1.8" spec.add_development_dependency "cucumber" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec" spec.add_development_dependency "shoulda-matchers" end
my spec_helper.rb
:
require 'my_gem' require 'pry' require 'shoulda/matchers' shoulda::matchers.configure |config| config.integrate |with| with.test_framework :rspec # with.library :active_record with.library :active_model # with.library :action_controller # or, choose of above: # with.library :rails end end
it's finding shoulda::matchers not .configure
method reason. requiring shoulda
wrong somehow? not sure if related, rspec giving me warning:
warn: unresolved specs during gem::specification.reset: json (>= 1.7.7, ~> 1.7) minitest (~> 5.1) warn: clearing out unresolved specs. please report bug if causes problems.
thanks pointers!
it looks trying use documentation 3.0.0.alpha version of shoulda-matchers supports 3.0.0.alpha
, using older version. either see correct documentation version using (i'm guessing 2.8.x) or update gemfile use 3.0.0.alpha
:
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers'
then run bundle install
, shoulda::matchers.configure
should start working.
Comments
Post a Comment