I have this model code:
validates_presence_of :setting_id
validates_presence_of :user_id
validates_presence_of :topic_id, if: :direct?
I have these rspec tests:
it { should validate_presence_of :setting_id }
it { should validate_presence_of :user_id }
it { should validate_presence_of(:topic_id).if(:direct?) }
The first 2 tests work ok.
The last one gives an error of:
undefined method 'if' for #<Shoulda::Matchers::ActiveModel::ValidatePresenceOfMatcher:0x007fda6a5c6268>
How can I add a similar tests for code fragment for the last presence of validation for (:topic_id).if(:direct?)