title: Testing before_filter gets called in action
body: <p>How would one test that when an action in controller is being accessed, that controller's before_filter will be executed?</p>
  
  <p>The before_filter is tested in separate example group so that there's no need to duplicate the tests for all actions that depend on the before_filter.</p>
  
  <p>If I have</p>
  
  <pre><code>controller.should_receive(:my_before_filter)
  </code></pre>
  
  <p>in my example, it works fine. However, having the above expectation seems to cause that the logic in <code>my_before_filter</code> is not being executed (it should assign an instance variable).</p>
  
  <p>How to overcome this restriction or to mock behaviour of my_before_filter (it sets instance variable on controller)? Or is there some better way to do this?</p>
  
  <hr>
  
  <p>As it's now clear I was doing it all wrong, I'd still like to know how one could mock the behaviour of before_filter that sets an instance variable. Surely it must be a possible to do this in a controller spec?</p>