Help us understand the problem. What is going on with this article?

shoulda-matchers 2.8.0で undefined method `validate_presence_of'などと出たので。

More than 5 years have passed since last update.
  • Rails 4.2.0
  • Rspec 3.2.2
  • shoulda-matchers 2.8.0
it { should validate_presence_of(:hoge) }
it { should validate_uniqueness_of(:hage) }

とかでundefined methodだと怒られました。調べてみると・・・




Having the same error with rails '4.2.0' & shoulda-matchers 2.8.0 & rspec-rails 3.1.0


spec_helperrequire 'shoulda/matcherを追加しろとか(ハイフンでなくてスラッシュであるのがポイントかな?)



It seems that reverting shoulda-matcher back to version 2.5.0 fix this.



group :test do
  gem 'capybara'
  gem 'faker'
  gem 'shoulda-matchers', '2.5.0'
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away