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

Bryan Ray bryansray at gmail.com
Fri Apr 11 14:34:55 EDT 2008

+1 ...

I often run in to this same problem, but wouldn't mind seeing an  
option for displaying some sort of warning (as others have suggested)  

On Apr 9, 2008, at 10:44 PM, Pat Maddox wrote:

> 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
>  end
> end
> 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.
> Pat
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list