undefined method `validate_presence_of' for RSpec::ExampleGroups::User::Validations
Add rspec-rails
and shoulda-matchers
in your Gemfile
:
group :development, :test do
gem 'rspec-rails', '~> 3.4', '>= 3.4.2'
gem 'shoulda-matchers', '~> 3.1', '>= 3.1.1'
end
Set your spec/rails_helper.rb
to use rspec-rails
and shoulda-matchers
:
require 'rspec/rails'
require 'shoulda/matchers'
And add in your spec/spec_helper.rb
:
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
I think you need to add the following to your spec_helper.rb
require 'shoulda/matchers'
Your specs are missing shoulda matcher's methods.
Here is the source. You can check. People complains similar things. https://github.com/thoughtbot/shoulda-matchers/issues/384