Forum: RSpec Sending rails errors to rspec output

Posted by LeeQ (Guest)
on 2011-12-22 06:04
(Received via mailing list)
I am using Capybara in combination with rspec for integration testing
of rails apps.

I would like any errors (routing errors, errors in a controller,
anything) generated during a test to be printed the same as "puts"
statements in rspec's output. Is this possible?  Additionally, is this
a reasonable idea, or am I just being silly?
Posted by Justin Ko (Guest)
on 2011-12-22 08:39
(Received via mailing list)
On Dec 16, 2011, at 8:46 AM, LeeQ wrote:

> I am using Capybara in combination with rspec for integration testing
> of rails apps.

Even though you are using Capybara, they are still just specs. No reason 
why "puts" won't work.
Posted by LeeQ (Guest)
on 2011-12-22 16:55
(Received via mailing list)
Puts does work.  That's not what I'm looking for.

I want all error messages (like `undefined local variable or method 
`junk'
for...` ) to show up in my rspec out put in *the same way as* `puts`.
Posted by Justin Ko (Guest)
on 2011-12-22 19:35
(Received via mailing list)
On Dec 22, 2011, at 8:25 AM, LeeQ wrote:

> Puts does work.  That's not what I'm looking for.
>
> I want all error messages (like `undefined local variable or method `junk' 
for...` ) to show up in my rspec out put in the same way as `puts`.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

So basically you want the exception message to display in the output, 
but then have things "continue on" like it *wasn't* an exception?

I don't see the point in that, but you could do it with `rescue`.
Posted by LeeQ (Guest)
on 2011-12-22 20:33
(Received via mailing list)
Ah, I see what you are saying.  But no, I still want the exception to 
act
like an exception.  My problem is that I'll have a test fail for reasons
unknown, and I then I need to open the test logs to find the exception.
 I'd like those exceptions to show up in my test output so I don't have 
to
dig for them.
Posted by Justin Ko (Guest)
on 2011-12-22 21:05
(Received via mailing list)
On Dec 22, 2011, at 11:33 AM, LeeQ wrote:

> Ah, I see what you are saying.  But no, I still want the exception to act like 
an exception.  My problem is that I'll have a test fail for reasons unknown, and I 
then I need to open the test logs to find the exception.  I'd like those 
exceptions to show up in my test output so I don't have to dig for 
them._______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Okay I see what you're talking about now. Take a look at this:

https://github.com/jnicklas/capybara/issues/358
Posted by Pat Maddox (Guest)
on 2011-12-22 22:16
(Received via mailing list)
On Dec 22, 2011, at 12:33 PM, LeeQ <leequarella@gmail.com> wrote:

> Ah, I see what you are saying.  But no, I still want the exception to act like 
an exception.  My problem is that I'll have a test fail for reasons unknown, and I 
then I need to open the test logs to find the exception.  I'd like those 
exceptions to show up in my test output so I don't have to dig for them.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


You need to configure the logger to log to standard out. Check out this 
link & modify as appropriate for your Rails version:

http://stackoverflow.com/questions/4800032/how-to-...


Pat
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.