In my code I had the following validation with Shoulda matchers, which works fine:
it { should validate_presence_of(:name) }
In my model, I've added the condition to my validation:
validates_presence_of :name, :if => eligible?
Is it possible to reflect it in the validations?
I've tried looking at documentation for shoulda matchers, but haven't been able to locate the solution.
Many thanks!
before { allow(subject).to receive(: eligible?).and_return(true) }
– Translucent