Cucumber with using Rspec should_receive
<script src="https://gist.github.com/1151447.js?file=test.rb"></script>
At the end of the test if restart has not been called then the entire test fails. Because of the way that cucumber works with rspec 1.3 (rails 2.x, which is required by the project) registering a should_receive has no effect (seems this is fixed in the cucumber/rspec versions for rails 3). Even if it were to work it would mean putting a Then before the When or putting a test in a Given. To me that just seems wrong.
<script src="https://gist.github.com/1151447.js?file=apache.feature"></script>
What I had to do to simulate a should_receive but still maintain the flow of the scenario was break it up so that I stub the function and when that function is called I set a flag. Later I test that the flag is set.
<script src="https://gist.github.com/1151447.js?file=apache-after.feature"></script>
The step that sets the flag is Apache can restart and the one that tests is Apache should restart. Here are the step definitions:
<script src="https://gist.github.com/1151447.js?file=apache_steps.rb"></script>