[rspec-users] rails rspec silently failing

Will Schenk wschenk at gmail.com
Tue Feb 5 23:50:27 EST 2008


This is both running the file directly or using script/spec.  If I  
leave the spec file as is, and I comment out a line  
@order.send_order_to_google_checkout in the _controller_ then it runs  
fine, i.e. it gets to the fail statement.  Either way the code runs  
all the way through the action method.  But if I call a method on the  
Order, then it seems to just disappear after the controller returns.   
Something is swallowing exceptions or something like that.  It runs to  
the end though, and I know it runs to the end because I put in puts  
statements.


On Feb 5, 2008, at 7:54 PM, Corey Haines wrote:

> That seems more like rspec isn't even finding it. What is the file  
> name? Is it in a location that rspec is going to look for it?
>
> -Corey
>
> On Feb 5, 2008 4:58 PM, Will Schenk <wschenk at gmail.com> wrote:
> I've been beating my head against this for a couple of hours now, and
> I'm a bit frustrated, so I apologize in advance.
>
> I'm trying to use rspec to test an order processing system, which uses
> google checkout.  The idea was to have a couple of orders in the
> database in various stages, and hit the notifier interface to make
> sure that everything transitioned to the right place.  However, I
> can't get to this, because rspec seems to silently blow-up somewhere.
> This code "passes":
>
> require File.dirname(__FILE__) + '/../spec_helper'
>
> describe OrdersController do
>   integrate_views
>   fixtures :orders
>
>   it "should set the right order amount" do
>     prepare_order_mock
>
>     post "subscribe", {:sub_type => "1"}
>
>     fail "This should throw an error"
>   end
> end
>
> It then returns: "0 examples, 0 failures".
>
> How is such a thing possible?  This seems like a serious problem; I
> would expect an exception from somewhere inside of the post, or the
> fail message.  Instead everything is green.
>
> My only hypothesis is that since I'm creating an order object and
> calling a bunch of methods on it and somehow that's verbotten.  The
> docs mention suggests mocking domain objects -- which seems if not
> completely misguided at least seriously counter-intuitive -- and
> perhaps this has something to do with it.  But silently imploding
> seems more like a bug.
>
> I should mention that the controller actually works in Real Life, but
> I was trying to get a little piece of mind and work out all the
> permutations in a test just to make sure.  And failing silently is
> worse than no testing at all.
>
> Taking a few deep breaths,
> -w
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
>
> -- 
> http://www.coreyhaines.com
> The Internet's Premiere source of information about Corey Haines

Will Schenk
wschenk at gmail.com
http://benchcoach.com/
http://sublimeguile.com/
http://menumap.monkeythumb.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080205/ded47915/attachment-0001.html 


More information about the rspec-users mailing list