title: How can I use `should validate_presence_of` with a custom error message?
body: <p>I'm testing my ActiveRecord models with Rspec. I've just added a custom error message to one of my validations, like this:</p>
  
  <pre><code>validates :accepted_terms_at, :presence =&gt; {:message =&gt; 'You must accept the Terms and Conditions to use this site.'}
  </code></pre>
  
  <p>Now the following test fails:</p>
  
  <pre><code>it { should validate_presence_of(:accepted_terms_at) }
  </code></pre>
  
  <p>... with the error <code>Expected errors to include "can't be blank" when accepted_terms_at is set to nil</code>.</p>
  
  <p>So the test fails because it's looking through the validation error messages and expects to find the default one.</p>
  
  <p><strong>How can I tell Rspec what the new validation message should be?</strong></p>
  
  <h2>What I've tried</h2>
  
  <p>1) Message as an argument:</p>
  
  <p><code>it {should validate_presence_of(:accepted_terms_at, :message =&gt; 'your message')}</code></p>
  
  <p>This gives the error <code>wrong number of arguments (2 for 1)</code></p>
  
  <p>2) Message as a chained method call</p>
  
  <p><code>it {should validate_presence_of(:accepted_terms_at).with('your message')}</code></p>
  
  <p>This throws an error because there is no <code>with</code> method.</p>