title: Is it possible to validate the context in a Draper decorator?
body: <p>I've started working with decorators at my new job and am finding them really helpful. I'm working on writing specs for one of our decorators and wondered if it was possible to do this...</p>
  
  <p><strong>Setup (the stripped down version):</strong></p>
  
  <p>We have a main object with two children.</p>
  
  <pre><code> Main
   / \
  A   B
  </code></pre>
  
  <p>When Main gets decorated we also decorate B, but we <em>must</em> pass A through as context. A is used for a few of B's decorator methods but it makes more logical sense to separate A from B as above.</p>
  
  <pre><code># in MainDecorator    
  BDecorator.new(B, context: {a: A}) # all good
  </code></pre>
  
  <p>Occasionally we decorate B on it's own (without going through Main) and we've forgotten to pass A through as context in the past. We always catch it, but it's an annoying issue to keep hitting.</p>
  
  <pre><code>B.decorate # no context -&gt; :(
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Is it possible to validate that A is getting passed through as context in B's decorator? Can you have a decorator validator?</p>
  
  <p>(We have considered making A a child of B, but this doesn't really make sense for our application. I agree it would work, but it's not what we want.)</p>