Forum: RSpec RecordNotFound bubbling thru to cucumber

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5dade05c7d95ee88f2d6d8970bb2071e?d=identicon&s=25 Jeff Talbot (Guest)
on 2009-02-06 19:00
(Received via mailing list)
Hello,

I have a controller action that raises a RecordNotFound exception if
you're not allowed to see something. In my global application
controller (application.rb), I catch these and render the 404
template. But when I run cucumber (using webrat), it's getting the
full stacktrace (the step blows up). Any ideas why? I have
consider_all_requests_local turned off in my test.rb.

Jeff
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2009-02-09 00:08
(Received via mailing list)
Which version of cucumber / webrat are you using?

On 6 Feb 2009, at 17:12, Jeff Talbot wrote:

> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-02-09 12:14
(Received via mailing list)
On Fri, Feb 6, 2009 at 6:12 PM, Jeff Talbot <jeff.a.talbot@gmail.com>
wrote:
> Hello,
>
> I have a controller action that raises a RecordNotFound exception if
> you're not allowed to see something. In my global application
> controller (application.rb), I catch these and render the 404
> template. But when I run cucumber (using webrat), it's getting the
> full stacktrace (the step blows up). Any ideas why? I have

It's because Cucumber's Rails support configures ActionController to
send all errors straight through.
See cucumber/rails/world.rb

Patches and suggestions about how to improve this are welcome.
(In most cases it's easier to spot errors when exceptions ripple
through)

Aslak
994e42bda994be2cd1d791f18ee6d561?d=identicon&s=25 Stephen Eley (Guest)
on 2009-02-09 16:15
(Received via mailing list)
On Mon, Feb 9, 2009 at 6:11 AM, aslak hellesoy
<aslak.hellesoy@gmail.com> wrote:
>
> It's because Cucumber's Rails support configures ActionController to
> send all errors straight through.
> See cucumber/rails/world.rb
>
> Patches and suggestions about how to improve this are welcome.
> (In most cases it's easier to spot errors when exceptions ripple through)

Make it a configuration option?  Or catch it with a proxy that
inspects the exception then passes it *back* to Rails, and provide
matchers or formatting options that display Cucumber's analysis only
when the user wants it?

I'm with Jeff on this: RecordNotFound isn't necessarily an "error,"
it's just an exception.  One that will frequently come up in normal
user interaction.  A well-behaved app will do appropriate things with
that exception and Cucumber should be able to test for those
appropriate things.  A testing framework that disrupts the application
behavior cannot test it.



--
Have Fun,
   Steve Eley (sfeley@gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine
   http://www.escapepod.org
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-02-09 16:43
(Received via mailing list)
On Mon, Feb 9, 2009 at 3:58 PM, Stephen Eley <sfeley@gmail.com> wrote:
> inspects the exception then passes it *back* to Rails, and provide
> matchers or formatting options that display Cucumber's analysis only
> when the user wants it?
>
> I'm with Jeff on this: RecordNotFound isn't necessarily an "error,"
> it's just an exception.  One that will frequently come up in normal
> user interaction.  A well-behaved app will do appropriate things with
> that exception and Cucumber should be able to test for those
> appropriate things.  A testing framework that disrupts the application
> behavior cannot test it.
>

Good points. Please create a Lighthouse ticket for this. I'm looking
forward to concrete suggestions about how to make this configurable
and patches I can pull in :-)

Aslak
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-02-09 18:08
(Received via mailing list)
On Mon, Feb 9, 2009 at 10:21 AM, aslak hellesoy
<aslak.hellesoy@gmail.com> wrote:
>> Make it a configuration option?  Or catch it with a proxy that
>>
>
> Good points. Please create a Lighthouse ticket for this. I'm looking
> forward to concrete suggestions about how to make this configurable
> and patches I can pull in :-)

There is already a ticket:

http://rspec.lighthouseapp.com/projects/16211/tick...

=)


>> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-02-09 18:26
(Received via mailing list)
aslak hellesoy wrote:
>>>
>> behavior cannot test it.
>>
>>
>
> Good points. Please create a Lighthouse ticket for this. I'm looking
> forward to concrete suggestions about how to make this configurable
> and patches I can pull in :-)
>
> Aslak
>

Instead of creating a new ticket we should probably continue the
discussion on this ticket:

http://rspec.lighthouseapp.com/projects/16211/tickets/49

-Ben
This topic is locked and can not be replied to.