2016-04-15 21 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或更高版本,警告應該消失。