[rspec-users] what's with the response.should_be_xxxx stacktrace?

Courtenay court3nay at gmail.com
Sat Dec 30 23:26:10 EST 2006


On 12/30/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> On 12/30/06, Courtenay <court3nay at gmail.com> wrote:
> > If I do
> >
> >     get :index
> >     response.should_be_success
> >
> > I get about 20k of marshalled dumpage that starts like
> >
> >   #<ActionController::TestResponse:0x390443c @body=\"<html><body>You
> > are being <a href=\"http://test.host/carts/1\">redirected</a>.</body></html>\",
> > @assigns=[], @redirected_to={:action=>\"show\", :id=>1},
> > @template=#<#<Class:0x38d5fc4>:0x38d5f9c @assigns={\"template_ro
> >
> > and finishes 20 pages later with
> >
> >   @headers={"Status"=>"302 Found", "cookie"=>[],
> > "Content-Type"=>"text/html; charset=utf-8",
> > "Cache-Control"=>"no-cache", "location"=>"http://test.host/carts/1"},
> > @session=#<ActionController::TestSession:0x390466c
> > @attributes={"flash"=>{}, :cart=>{}}>> should be success nil
> >
> > My question is, is this intended, or just a side-effect of using
> > should_be_xxxx?  In which case, particularly regarding the "artificial
> > sugar causes cancer", the response should_be really could be more
> > nicely formatted ("response should be success but was 'redirect' to
> > 'http://'")
> >
> > Finally, while I'm assuming that I'm doing it properly, is there a
> > better way to do the response code checking?
>
> You're doing the right thing re: response code checking. In the
> future, please consider raising a bug report for things like this. I
> took the liberty of doing so:
>
> http://rubyforge.org/tracker/index.php?func=detail&aid=7506&group_id=797&atid=3149
>

Awesome..!  OK, will do in future.  I generally assume that I'm doing
it wrong if I get a page o' code.. still fumbling my way around the
syntax.


Courtenay
http://blog.caboo.se


More information about the rspec-users mailing list