title: How can I DRY up assertions that a method is called with an expected argument?
body: <p>I need to write examples that test an argument passed to a method.</p>
  
  <p>Option #1 is to return the received argument as subject so that the verification part can be very concise:</p>
  
  <pre><code>subject do
    color = nil
    pen_double.should_receive(:color=) do |arg|
      color = arg
    end
    color
  end
  
  context ...
    it { should == 'red' }
  end
  
  context ...
    it { should == 'green' }
  end
  </code></pre>
  
  <p>The problem with this option is that the "subject" part is bulky. And it becomes big problem when I start to test other methods (there are many methods that need to be tested). </p>
  
  <p>Option #2 is not to use "subject". instead it reads:</p>
  
  <pre><code>context ...
    it { pen_double.should_receive(:color=).with('red') }
  end
  
  context ...
    it { pen_double.should_receive(:color=).with('green') }
  end
  </code></pre>
  
  <p>Obviously now the 'it' part is not DRY enough.</p>
  
  <p>Is there a 3rd option that I overlooked?</p>