2016-04-15 75 views
0

我的测试似乎是相当直截了当:废弃警告rspec的3.3.3

describe MyModel do 

    describe 'validations' do 
    it { is_expected.to validate_presence_of(:relation_object) } 
    end 
end 

我得到这样的警告:

eprecation警告:

-------------------------------------------------------------------------------- 
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. 

我在做什么错?

回答

2

你没有做错任何事情。你只是使用旧版本的shoulda-matchers来实现一个较旧的协议。看起来shoulda-matchers已更新,以解决2.5中的弃用警告,因此如果将shoulda-matchers更新为2.5.0或更高版本,警告应该消失。