title: Shoulda/RSpec matchers - conditional validation
body: <p>In my code I had the following validation with Shoulda matchers, which works fine:</p>
  
  <pre><code>it { should validate_presence_of(:name) }
  </code></pre>
  
  <p>In my model, I've added the condition to my validation:</p>
  
  <pre><code>validates_presence_of :name, :if =&gt; eligible?
  </code></pre>
  
  <p>Is it possible to reflect it in the validations?</p>
  
  <p>I've tried looking at <a href="https://github.com/thoughtbot/shoulda-matchers" rel="noreferrer">documentation</a> for shoulda matchers, but haven't been able to locate the solution.</p>
  
  <p>Many thanks!</p>