[rspec-devel] Should controller specs fail if you don't make a request?

Pat Maddox pergesu at gmail.com
Wed Apr 9 23:44:09 EDT 2008

A friend of mine just IMed me asking why his spec didn't pass.  It looked like

describe FooController, "POST create" do
  it "should build a new Foo" do
    Foo.should_receive(:new).and_return @mock_foo

I looked at the spec for a second, then looked at the implementation
and it looked fine (he's retrofitting specs on).  Looked back at the
spec and realized that he never actually made a request.

So here's my question: should controller specs fail if no request is
made?  I have NEVER written a controller spec in which I didn't
_intend_ to make a request, though I have forgotten to make a request
plenty of times.

I had planned to just implement an expectation error if no request is
made.  But there's a small chance that that's too invasive.  I highly
doubt it though.  Does anyone have specs that would incorrectly fail
as a result of this change?  Please show code if you do.


More information about the rspec-devel mailing list