shoulda-matchers 2.8.0で undefined method `validate_presence_of'などと出たので。
it { should validate_presence_of(:hoge) } it { should validate_uniqueness_of(:hage) }
とかでundefined method
だと怒られました。調べてみると・・・
ちょっとバージョンが古いのですが、その他のコメントを見ると
https://github.com/thoughtbot/shoulda/issues/203#issuecomment-73694540
Having the same error with rails '4.2.0' & shoulda-matchers 2.8.0 & rspec-rails 3.1.0
新しくても問題は起こっているようです。
spec_helper
でrequire 'shoulda/matcher
を追加しろとか(ハイフンでなくてスラッシュであるのがポイントかな?)
いろいろあるんですが、結局
https://github.com/thoughtbot/shoulda/issues/203#issuecomment-42126779
It seems that reverting shoulda-matcher back to version 2.5.0 fix this.
これがめんどくさくなくていいかな、と思いバージョンを2.5.0
に指定して入れ直しましたよと・・・。
Gemfile
. . group :test do gem 'capybara' gem 'faker' gem 'shoulda-matchers', '2.5.0' end