なぜこのエラーが出るのか
内容的には BigDecimal.new は非推奨だから BigDecimal() 使えよってことです。
ruby v2.6 から BigDecimal.new は非推奨になっています。
僕の場合は、matcherがBigDecimal.newでした。
shoulda/matchers/active_model/validate_inclusion_of_matcher.rb:273:
warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
これにぴったりのissueを見つけました。
https://github.com/thoughtbot/shoulda-matchers/pull/1070
解決方法
今のgemfileにあるmatcher
group :test do
gem 'shoulda-matchers',
git: 'https://github.com/thoughtbot/shoulda-matchers.git',
branch: 'rails-5'
公式を見ると、
gem 'shoulda-matchers', '~> 4.0'
になっているから、それでbundle installをする。
https://github.com/thoughtbot/shoulda-matchers
group :test do
gem 'shoulda-matchers', '~> 4.0'
end
rspec
....*****....................
Pending: (Failures listed here are expected and do not affect your suite's status)
1) Comment add some examples to (or delete) /myapp/spec/models/comment_spec.rb
# Not yet implemented
# ./spec/models/comment_spec.rb:4
2) Favorite add some examples to (or delete) /myapp/spec/models/favorite_spec.rb
# Not yet implemented
# ./spec/models/favorite_spec.rb:4
3) Like add some examples to (or delete) /myapp/spec/models/like_spec.rb
# Not yet implemented
# ./spec/models/like_spec.rb:4
4) PostTag add some examples to (or delete) /myapp/spec/models/post_tag_spec.rb
# Not yet implemented
# ./spec/models/post_tag_spec.rb:4
5) Tag add some examples to (or delete) /myapp/spec/models/tag_spec.rb
# Not yet implemented
# ./spec/models/tag_spec.rb:4
Finished in 12.14 seconds (files took 3.48 seconds to load)
29 examples, 0 failures, 5 pending
無事warning: BigDecimal.new is deprecated; のエラーが消えていた。