Gandalf StormCrow Gandalf StormCrow - 1 year ago 98
Ruby Question

Deprecation Warnings rspec 3.3.3

My test seems to be pretty straight forward :

describe MyModel do

describe 'validations' do
it { validate_presence_of(:relation_object) }

I get this warning:

eprecation Warnings:

Shoulda::Matchers::ActiveModel::ValidatePresenceOfMatcher implements a legacy RSpec matcher
protocol. For the current protocol you should expose the failure messages
via the `failure_message` and `failure_message_when_negated` methods.

What am I doing wrong?

Answer Source

You're not doing any thing wrong. You're just using an old version of shoulda-matchers that implements an older protocol. It looks like shoulda-matchers was updated to address that deprecation warning in 2.5 so if you update shoulda-matchers to 2.5.0 or greater the warning should go away.