thoughtbot/shoulda

NoMethodError validate_presence_of

Closed this issue · 2 comments

Hi

I am getting no method error while running test on rails 4.1.8. I even tried different version of shoulda matcher. Unfortunately nothing seems to be working. Any suggestions?

Failures:

  1. User : Email id required
    Failure/Error: should validate_presence_of(:email)
    NoMethodError:
    undefined method `validate_presence_of' for #RSpec::ExampleGroups::User:0x00000005da36a8

    ./spec/models/user_spec.rb:9:in`block (2 levels) in <top (required)>'

Gemfile:
group :development, :test do
gem 'rspec-rails', '~> 3.1.0'
gem 'factory_girl_rails'
end

group :test do
gem 'shoulda-matchers', '2.7.0'
gem 'cucumber-rails', require: false
gem 'database_cleaner'
gem 'selenium-webdriver'
end

Spec helper:
require 'shoulda/matchers'

Any help would be great.

"The belong_to and validate_presence_of methods are the matchers. All matchers are Rails 3-specific."
This is from https://github.com/thoughtbot/shoulda README.md .Your rails is 4.1.8 . That might be why.

Closing this due to lack of activity.